HELP TO FORM DYNAMIC INSERT QUERY IN PL/SQL [message #650679] |
Fri, 29 April 2016 07:15 |
|
ibnelyas
Messages: 5 Registered: October 2015
|
Junior Member |
|
|
hi all..
currently am trying to read a file and insert data into a table..
Am attaching the my pl/sql which is working fine..
i would like to simplify my code as mentioned in the commented line as shown below.. pls help
-- values (AUTOID.NEXTVAL , v_newline ,SYSDATE ) -- CAN THIS CODE WORK
bear with my question if meaningless or so simple..
|
|
|
|
Re: HELP TO FORM DYNAMIC INSERT QUERY IN PL/SQL [message #650682 is a reply to message #650681] |
Fri, 29 April 2016 07:38 |
cookiemonster
Messages: 13920 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
So to be clear you want to know if this insert:
INSERT INTO temp_sap_charges
(auto_chrg_seq, chrg_code, chrg_description, gl_code,
created_date
)
VALUES (auto_id.NEXTVAL, chrgcode, chrgdesc, glcode,
SYSDATE
);
Can be changed to this:
INSERT INTO temp_sap_charges
(auto_chrg_seq, chrg_code, chrg_description, gl_code,
created_date
)
values (AUTOID.NEXTVAL , v_newline ,SYSDATE );
Where v_newline holds the comma seperated values for chrg_code, chrg_description and gl_code.
No, you can't, unless you make the insert an actual dynamic sql statement. And I see no benefit to doing that what so ever.
Your code is fine as it is.
[Updated on: Fri, 29 April 2016 08:06] Report message to a moderator
|
|
|
|
|