| Not able to insert with returning option on view with instead of trigger [message #646826] |
Mon, 11 January 2016 03:07  |
saini006
Messages: 9 Registered: July 2008 Location: hyderabad
|
Junior Member |
|
|
CREATE TABLE BANK
( TRAN_ID NUMBER(10,0),
TRAN_TYPE VARCHAR2(5 BYTE),
AMMOUNT NUMBER(6,2),
LOAD_DATE TIMESTAMP (6)
);
create view v_bank as select * from bank;
create or replace
TRIGGER IOI_bank
INSTEAD OF INSERT
ON v_bank
for each row
DECLARE NUMROWS INTEGER;
V_LOB ACCOUNT_PROGRAMS.LINE_OF_BUSINESS%TYPE;
BEGIN
DBMS_OUTPUT.PUT_LINE('v_lob '||v_lob);
Insert into BANK
(TRAN_ID,
TRAN_TYPE,
AMMOUNT,
LOAD_DATE
)
values
(:new.TRAN_ID
,:new.TRAN_TYPE
,:NEW.AMMOUNT
,:NEW.LOAD_DATE);
END;
SET SERVEROUTPUT ON
DECLARE
V_NUM NUMBER;
BEGIN
INSERT INTO V_BANK
VALUES (1,'BA',100,SYSDATE) RETURNING TRAN_ID INTO V_NUM;
DBMS_OUTPUT.PUT_LINE('333333 '||V_NUM);
END;
/
I am getting below error while inserting v_bank
Error report:
ORA-22816: unsupported feature with RETURNING clause
ORA-06512: at line 4
can you please suggest. I am sending example of my code.
Thanks in Advance
Santosh
CM: fixed the code tags. Out code tags are [code] and [/code] not {code}
[Updated on: Mon, 11 January 2016 03:13] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
| Re: Not able to insert with returning option on view with instead of trigger [message #646851 is a reply to message #646828] |
Mon, 11 January 2016 22:33  |
 |
Kevin Meade
Messages: 2103 Registered: December 1999 Location: Connecticut USA
|
Senior Member |
|
|
This is a known limitation. It has been this way since both features were available. It is just another example of how "advanced" features in Oracle do not always work with each other.
In the end you will have to choose, which do you want more, (TRIGGERS vs. RETURNING).
Sorry, that's life. Good to see someone giving the database a workout though. Keep going.
Kevin
|
|
|
|