insertion through report builder [message #603112] |
Wed, 11 December 2013 08:32 |
|
thelearner
Messages: 133 Registered: April 2013 Location: INDIA
|
Senior Member |
|
|
Hi,
I want to insert data into custom table when report builder retrieves the data from database.
For example if report builder retrieve 4 records from emp table, the 4 records should insert into another table like emp2.
If I want insert only particular columns only how to do?
Any suggestions please.
|
|
|
Re: insertion through report builder [message #603135 is a reply to message #603112] |
Wed, 11 December 2013 10:24 |
|
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
In my opinion, you chose wrong tool to do that. Report is for reporting, displaying values to end users.
Anyway: inserting data isn't a problem, you can do that in one of Reports triggers (After Parameter Form could be a good choice). However, making it "dynamic" (as once you want to insert 4 records, another time 15 etc.) leads to different WHERE clause which depends on parameters passed to the report. Fine - use a lexical variable in order to dynamically create WHERE clause. It can be used in report's query, but I don't know how to use it elsewhere (i.e. in an INSERT statement).
Maybe you should investigate how to emulate dynamic SQL in PL/SQL (after all, Reports' triggers are PL/SQL), which means that you should compose the whole INSERT statement (including column list as well as SELECT and WHERE clauses) and execute it with SRW.DO_SQL built-in procedure (open Reports Help system and read more about it).
|
|
|