Home » SQL & PL/SQL » SQL & PL/SQL » does anyone know how to insert a record instead of ...
does anyone know how to insert a record instead of ... [message #36084] Fri, 02 November 2001 23:49 Go to next message
JRW
Messages: 8
Registered: October 2001
Junior Member
Hi,

Within a PL/SQL procedure I have an insert statement with 162 columns in it. I'd like to be able to just insert
a record instead of having to show 162 columns in the insert statement.

Thanks

----------------------------------------------------------------------
Re: does anyone know how to insert a record instead of ... [message #36099 is a reply to message #36084] Mon, 05 November 2001 10:58 Go to previous message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
I don't think it's possible. but you can always do a "select *" if you want all the columns and the structure is identical but I guess you know that. Make the job easier by writing some sql to generate the statement for you.

something like this (untested)

set serveroutput on
begin
dbms_output.put_line('insert into my_tab(');
for col in (select column_name from user_tab_columns where rownum < 10) loop
dbms_output.put_line(col.column_name||',');
end loop;
dbms_output.put_line(') select...whatever');
end;

obviously you need to remove the last trailing ',' etc etc.

----------------------------------------------------------------------
Previous Topic: Need some suggestion on the frontend
Next Topic: Stored Procedure problem
Goto Forum:
  


Current Time: Sat May 28 12:55:01 CDT 2022