I am running a PL/SQL code on oracle which is supposed to insert data from table 'A' into a table 'B' along with a unique sequence being returned from a function. My sql query is like this
SEQUENCE_COLUMN:=SEQ_COL_FUNC('WTPARTMASTER', 'ELEM10',SEQUENCE_COLUMN);
sequence_value:=seq_val_func('WTPARTMASTER', 'ELEM10',sequence_value);
dest_Columns:=dest_Columns || ',' || sequence_column;
QUERY_TEST := 'insert into wbm.' || DESTINATION_TABLE || '(' || DEST_COLUMNS || ') select ' || SRC_COLUMNS || ', :value from ' || SOURCE_TABLE;
execute immediate query_test USING sequence_value;
Now the issue is in this way, select statement brings whole data in one go and I get same sequence no. in each row instaead of unique sequence number.
How can manipulate the query here such that I get the data as well as sequence inserted in my destination table one by one such that sequence no is unique.
Thanks for your help.