Database Reference
In-Depth Information
Figure 24.10
Syntax for the
DML
RETURNING
INTO Clause.
DECLARE
VARTIST_ID ARTIST.ARTIST_ID%TYPE;
BEGIN
INSERT INTO ARTIST(ARTIST_ID,NAME)
VALUES(ARTIST_ID_SEQ.NEXTVAL,'The Goanna Band')
RETURNING ARTIST_ID INTO VARTIST_ID;
INSERT INTO SONG(SONG_ID, ARTIST_ID, TITLE)
VALUES(SONG_ID_SEQ.NEXTVAL, VARTIST_ID
, 'The Razor''s Edge');
END;
/
The next section looks at dynamic SQL. Dynamic SQL is SQL or PL/
SQL code generated on the fly, usually generically from within an applica-
tion or some other calling process.
24.6
Dynamic SQL
Dynamic or generic programming is a term applied to programming where
portions of the code are constructed at run-time. As a result, dynamic SQL
is flexible based on user or parameter input. Two types of dynamic SQL can
be used:
The EXECUTE IMMEDIATE command.
Search WWH ::




Custom Search