Wednesday, November 19, 2008

ORACLE PL/SQL 5

101. Can one use dynamic SQL within PL/SQL?

From PL/SQL V2.1 one can use the DBMS_SQL package to execute dynamic SQL statements.
Ex:

CREATE OR REPLACE PROCEDURE DYNSQL AS
cur integer;
rc integer;
BEGIN
cur := DBMS_SQL.OPEN_CURSOR;
DBMS_SQL.PARSE(cur, 'CREATE TABLE X (Y DATE)', DBMS_SQL.NATIVE);
rc := DBMS_SQL.EXECUTE(cur);
DBMS_SQL.CLOSE_CURSOR(cur);
END;

102. How many triggers you can assign to a single table?

Maximum you can give 12 triggers to a table.

103. Why we are using Exception?

Exception section is used to trap the errors that are produced by a user program and for the smooth execution of our PL/SQL program without hanging up.

104. Can you nest a block in the EXCEPTION clause?

No, we can’t nest a block in the exception clause.

No comments:

View My Stats