aaba646
asked on
How to insert values in a table based on a flag condition which output of a select query inside a stored procedure
Hi, I have a package which consists following procedure:
PROCEDURE sp_abc(in_user_id IN VARCHAR2,
in_code_id IN INTEGER,
out_cursor OUT E_CURSOR)
IS
BEGIN
OPEN out_cursor FOR
<SELECT query>
<IF flag is Y, for one of the column> THEN
INSERT into table xyz
COMMIT;
END IF;
END sp_abc;
E_CURSOR is weak cursor.This cursor returns record set which is used by VB application.
Inside the procedure how can i select a field from out of select query for which flag is Y
and based on that i have to insert values in different table.
Thanks in advance
PROCEDURE sp_abc(in_user_id IN VARCHAR2,
in_code_id IN INTEGER,
out_cursor OUT E_CURSOR)
IS
BEGIN
OPEN out_cursor FOR
<SELECT query>
<IF flag is Y, for one of the column> THEN
INSERT into table xyz
COMMIT;
END IF;
END sp_abc;
E_CURSOR is weak cursor.This cursor returns record set which is used by VB application.
Inside the procedure how can i select a field from out of select query for which flag is Y
and based on that i have to insert values in different table.
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Forced accept.
Computer101
EE Admin
Computer101
EE Admin
You can use a MERGE statement for this work, but it depends how you will handle values that are already present. If you want a new record to be inserted even though one already exists, you cannot use a merge. If it is important that no duplicates are inserted, a merge would be the best way