Q:

Write a program in PL/SQL to insert a row if the featched value for a component is specified

0

Write a program in PL/SQL to insert a row if the featched value for a component is specified.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

DROP TABLE TEST;
CREATE TABLE TEST(
c1 INTEGER,
c2 INTEGER);

DELETE FROM TEST;
INSERT INTO TEST VALUES(2, 4);
INSERT INTO TEST VALUES(1, 3);


DECLARE
    n1 NUMBER;
    n2 NUMBER;
BEGIN
    SELECT c1,c2 INTO n1,n2 FROM TEST WHERE c1>1;
   IF n2=4 THEN
        INSERT INTO TEST VALUES(n2,n1);
    ELSE
        INSERT INTO TEST VALUES(n2+15,n1+15);
    END IF;
END;
/

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now