How could I insert the deleted row into another table within a trigger?
Hi,
How could I insert the deleted row into another table within a trigger? The destination table has the same columns as the source table. Since the statements are in the trigger, it is not allowed to query the source table named 'test'. Thanks! The trigger is as follows, uncompleted:
CREATE TRIGGER delete_trigger
AFTER DELETE
ON test
FOR EACH ROW
BEGIN
-- How could I insert the deleted row into another table
END delete_trigger;
Message was edited by:
user569548
Hi,
I'm not sure what's wrong there.
I read the oracle docs about ANALYZE and ALL_TAB_COLUMNS, and did the following:
ANALYZE TABLE my_tab VALIDATE STRUCTURE; //went ok.
SELECT column_name
FROM all_tab_columns
WHERE table_name = 'my_tab'; //but no rows selected?
This topic might not be what this thread should be about. Here I posted a new thread:
How to get colum names of the newly created table?
Thanks.
Message was edited by:
user569548
Similar Messages
-
Need help in SQL Query: Update a row in a table & insert the same row into another table
I want to update a row in a table say Table A and the updated row should be inserted into another table say Table B. I need to do it in a single SQL query and i don't want to do it in PL/SQL with triggers. And i tried with MERGE statement but its working with this scenario. (Note: I'm using Oracle Database 10g Enterprise Edition Release 10.2.0.1.0).
Thanks in Advance.Using Sven's code as an example, you could save the updated row in a sql plus variable. (also untested):
SQL> var v_id number
update tableA
set colB='ABC'
where colC='XYZ'
returning id into :v_id;
insert into table A_History (ID, colA, colB, ColC)
select id, ColA, ColB, ColC
from tableA
where id = :v_id; -
HT1518 I have a Universal Keyboard how to I insert the copywrite symbol into my photographs
Have tried but to no avail, how can I insert the Copywrite symbol into my photographs to protect them before posting online please.
Alberto Ravasio wrote:
You meant option+C
Nope. On an English keyboard you get © with option-g. Option-c gets you ç. -
After reinstalling game, the achievements from Game Center doesn't uploaded to the game and starts from the beginning . All the achievements are seen in the Game Center . How could I upload the last progress into the game?
Hello there, Elena Lyubina.
The following Knowledge Base article offers up some great steps for troubleshooting issues with an application not functioning as expected:
iOS: An app you installed unexpectedly quits, stops responding, or won’t open
http://support.apple.com/kb/ts1702
Thanks for reaching out to Apple Support Communities.
Cheers,
Pedro. -
How to insert apex_application_files file content into another table?
Hi All,
I am using Apex 3.2 on Oracle 10g.
I have used 'file_browse' item to upload a spreadsheet file into apex_application_files table.
I would like to populate another table with the contents of this spreadsheet file from apex_application_files.
I have spent almost 2 days looking for an answer on how to do this.
Can you please tell me how to do this or point me to a good resource?
Thank you,
Naushad.Hi Thanks,
I did see this code, but this is not what I was looking for. This code simply inserts the file into another table, but I was looking for the contents of this file (eg. a single column spreadsheet with 10 lines and all ten of these lines to be inserted as rows in a table) inserted as rows into another table.
I managed to implement this by following below link:
http://nzchaudhry.wordpress.com/2011/07/18/uploading-csv-using-oracle-application-express-apex/
Thanks to all of you.
Naushad. -
How can we pass the entire rows of a table to a web service in a VC model ?
Hi,
On the click of the submit button, I have to pass the rows of two tables into an enterprise service. This service also takes other fields of a form as an input.
How can we pass the entire rows of a table into a service ?
Regards,
NitinHi Nitin,
It seems that you have two or three different structures to pass data using your webservice. In your main question, two tables, you can join both in one table and from there call the webservice. In order to pass the entire table you need:
1. Draw a line between your joinned table and your service,
2. Map the fields,
3. Create a 'SUBMIT' in your table tool bar. Right click on your table and choose 'Create Toobar', '+', name and choose 'Submit' as your event.
4. Go to Configure Element (Table View) 'Multiple' at Selection Mode.
Reward points if helps you to solve your question.
Regards,
Gilson Teixeira -
How can I insert a completed file into another PDF file I am developing?
How can I insert a completed file into another PDF file I am developing?
Please refer : http://acrobatusers.com/tutorials/how-to-insert-a-pdf-into-a-pdf
-
SSRS How to pass subtotal value in matrix into another table just for display?
Hi all,
I have two matrix with subtotal for two grouping. I need to pass the value of this two group subtotal into another matrix table to display and perform simple calculation to get the differences.
How can I pass the subtotal amount into the other matrix?
In Crystal report I can define two variable where i can set the total to the value and call the two variable anywhere in the same report. But how can I do it in SSRS?
Appreciate can help
Thank youYes, basically both are same grouping, i just want to capture the subtotal for comparision with scenario 2.
I can do it in SQL, but if possible, I hope to do it in report. Thank you
Simulation as below
Matrix for scenario 1
Group 1
Detail
Detail
Subtotal Group 1
9999
group 2
Detail
Detail
SubTotal Group 2
8888
Matrix for scenario 2
Group 1
Scenario2
Scenario 1
Differences
Detail
Detail
Subtotal Group 1
2000
9999
2000-9999
group 2
Detail
Detail
SubTotal Group 2
3000
8888
3000-8888 -
How to get Inserted and Deleted Rows in ALV
I have looked at the BC_EDIT* examples but I still can't figure out how to determine which rows were Inserted and Deleted from the ALV list. Can someone please provide me the code to do this?
Thanks.
SandyHi sandy,
i dont think you will have issue in inserting a row in ALV because whenever the user done some actions say for eg clicking the pushbutton at the toolbar you could insert the a new row into the ALV.for creating pushbutton you need to use the events TOOLBAR,USER_COMMAND.
deleting a row may also follow the above procedure.
Have a look at the demo program
BCALV_GRID_05
Cheers,
Abdul Hakim -
Question about how not to insert the same row twice
hello everyone
i have two tables
table employee_list
employee_id
employee_name
employee_num
employee_date
and table employee_form
employee_id
employee_name
employee_num
employee_date
table employee_form should contain the exact data like employee_list .
if there are missing data i'm inserting it to table employee_form_miss(missing).
now i have a probelm cause the compair between the two table,take place
more then just one time.now if there are still missing data i don't want that to table employee_form_miss will insert the same data that already exist in this table.
i've been thinking about constraints table employee_form_miss(employee_id
employee_name
employee_num
employee_date).
but i think it will be a wird way to handle this because i will do an insert
and then what rollback? or delete?
please help me how to manage this
thanks in advance.hello everyone
i have two tables
table employee_list
employee_id
employee_name
employee_num
employee_date
and table employee_form
employee_id
employee_name
employee_num
employee_date
i'm using an embedded sql in cobol program
DECLARE AA CURSOR FOR
select a.employee_name ,a.employee_num,a.employee_date
from employee_list a
WHERE a.employee_date = :employee-date
and NOT EXISTS
(select null from employee_form
WHERE employee_name =a.employee_name and
employee_num = a.employee_num and
employee_date = a.employee_date )
i'm doing open and fetch to the cursor.
and loop over the sqlerrd(3) result in order to insert them to the employee_form_miss table
insert into employee_form_miss (employee_name,employee_num,employee_date)
values (:employee-name,:employee-num,:employee-date)
the employee_id in table employee_form_miss there is a trigger which
Increment the sequence by 1 for each row that we insert.
so my question was that if i'm doing a constraint, so still i have to do
an insert and then if there is a constraint to do rollback or delete
from duplicate row. is there a better way to manage this ?
thank you -
How to get last insert/update/delet row of a table?
I hava a table A and table B which is a copy of A. I want to create a trigger to record the changes of A in B. So every time inserting/updating/deleting A I record the row inserted/updated/deleted in B, But I can't find a effiencial way to get the latest row changed.
So is there any sys_var in oracle table like cur_rowid or something to record the latest inserted/updated/deleted in a table? I don't want to check a index or a table to get the max_seq_id again.user11228816 wrote:
I hava a table A and table B which is a copy of A. I want to create a trigger to record the changes of A in B. So every time inserting/updating/deleting A I record the row inserted/updated/deleted in B, But I can't find a effiencial way to get the latest row changed.
So is there any sys_var in oracle table like cur_rowid or something to record the latest inserted/updated/deleted in a table? I don't want to check a index or a table to get the max_seq_id again.Sounds like an ugly requirement, any reason you're not going for materialized views or advanced replication here? -
SQL Loader need to insert the input filename into output table
Hi All,
I've a small problem with my SQL Loader query. My sql loader should read a file and write the data into a file. Also this sql loader should read the filename and write it into the same table. Here's my control file code:
LOAD DATA
APPEND
INTO TABLE XXMW_STG_SOH_HEADER_UK
WHEN (1:4) = '7010'
TRAILING NULLCOLS
(WH POSITION(5:6)
,ITEM POSITION(9:26)
,PRODUCT_STATUS POSITION(33:34)
,BALANCE_ON_HAND POSITION(35:43)
,TO_SHIP_QTY POSITION(71:79)
,RUSH_TO_SHIP_QTY POSITION(80:88)
,RESERVED_QTY POSITION(175:183)
,SNAPSHOT_DATE POSITION(134:143) CHAR "TO_DATE(:SNAPSHOT_DATE,'YYYY-MM-DD')"
,SNAPSHOT_TIME POSITION(144:151) CHAR "TO_DATE(:SNAPSHOT_TIME,'HH24:MI:SS')"
,PROCESSED_IND CONSTANT "N"
,PROCESSED_DATETIME SYSDATE
,_FILENAME POSITION(184) CHAR TERMINATED BY WHITESPACE_
My program should read the filename dynamically (means a shell script is calling this .ctl file which is reading multiple input files) and insert into the filename field in xxmw_stg_soh_header_uk table.
Please let me know for any questions/clarifications.
Regards,
DebabrataWhile I think Blu's suggestion to use external tables is better, if you need to use SQL Loader, you could do something like this.
Create a "generic" control file with a placeholder for the filename, something like:
LOAD DATA
APPEND
INTO TABLE XXMW_STG_SOH_HEADER_UK
WHEN (1:4) = '7010'
TRAILING NULLCOLS (
WH POSITION(5:6),
ITEM POSITION(9:26),
PRODUCT_STATUS POSITION(33:34),
BALANCE_ON_HAND POSITION(35:43),
TO_SHIP_QTY POSITION(71:79),
RUSH_TO_SHIP_QTY POSITION(80:88),
RESERVED_QTY POSITION(175:183),
SNAPSHOT_DATE POSITION(134:143) CHAR "TO_DATE(:SNAPSHOT_DATE,'YYYY-MM-DD')",
SNAPSHOT_TIME POSITION(144:151) CHAR "TO_DATE(:SNAPSHOT_TIME,'HH24:MI:SS')",
PROCESSED_IND CONSTANT "N",
PROCESSED_DATETIME SYSDATE,
FILENAME CONSTANT ":FILE"I am assuming that your shell script is looping through a set of file names and loading each one. So make your shell script look something like:
FILES=`ls *.txt`
CTL=generic.CTL
for f in $FILES
do
cat $CTL| sed "s/:FILE/$f/g" > $f.ctl
sqlldr usr/passwd control=$f.ctl data=$f
doneThe line cat $CTL| sed "s/:FILE/$f/g" > $f.ctl will create a "custom" control file for each file and add the filename as a constant at the end.
John -
How can I Export the Image file into Oracle Table
<tt>
Hi Folks,
I have one requirement with me, but i can't able to find the solution for that, so kindly any one give a suggestion for my requirement.
Let me explain my requirement in detail.. I have one table called SIGN this table contain customer signature image as well as the image of the customer. The SIGN have the following columns
</tt>
CREATE TABLE SIGN
ID VARCHAR2(50 BYTE) NOT NULL, "This column containing the Customer ID"
IMAGE_C_FLAG CHAR(1 BYTE) NOT NULL, "This column containing the whether ID belong to Signature or Photo"
IMAGE BLOB, NOT NULL, "This Column Containing the Image "
ENTERED_C_BY VARCHAR2(10 BYTE)
The SIGN having the following values
ID C I IMAGE
23900033 Y S (BLOB)
23900034 Y S (BLOB)
23900035 Y S (BLOB)
23900036 Y S (BLOB)
23900042 Y S (BLOB)<tt>
I want to export those Image from Table into my machine local folder with the extension of .JPEG(C:\IMAGE)
How can i do that in oracle... please kindly any one give the solution for this..
This is my Oracle server version
BANNER
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Prod
PL/SQL Release 10.1.0.2.0 - Production
CORE 10.1.0.2.0 Production
TNS for 32-bit Windows: Version 10.1.0.2.0 - Production
NLSRTL Version 10.1.0.2.0 - Production
Thanks in Advance
Arun
</tt>Hi Arun,
Please view the below links. Hope these helps you as there are also of similar discussion.
Insert Picture (image) using oracle forms
Insert Picture (image) using oracle forms
insert image to atable in forms builder
Re: insert image to atable in forms builder
Thanks,
Balaji K. -
How could we read the XML data from a table using BODS.
Hi Guys,
My requirement is , As the OLTP system consists of a table called person which consists of a column demographics. so how could i read this XML data which is in one column of an SQL table called persons. As this XML data will populate the remaining fields in my target using BODS.
Regards,
Amjad.Hi Amjad,
I am afraid there ain't any direct method to extract XML field from a data base.
Indirect way could be converting the whole table (instead of one field) into XML format and then extract one field from it!!
Regards,
Mubashir Hussain -
How can I know the target row in drop table?
I'm implementing 'drag-and-drop' a record from a table to another table(both are set read-only table).
After dropping, the record will be removed from source table and be inserted into target table.
But the problem is that it's not simply added.
When a record is dropped, it must be inserted right after target row which the mouse is over.
(Target table records have a kind of order number and re-ordering will be needed at each drag-and-drop)
I tried with EL from VO like '#{bindings.Testtbl2View1.currentRow}', but it returned a selected row before, not the target row(which mouse is over).
Please advise me.Hi
SELECT * FROM ALL_TAB_COLUMNS WHERE
TABLE_NAME ='EMPLOYEES' AND owner=<OwNeR nAmE> ;)
Maybe you are looking for
-
New computer...can I upload my iweb files? it's not working!
I recently purchased a macbook pro and need to keep working on my website. I had created one using iweb on my previous ibook but now when I open iweb on this new computer, it won't let me open or import my files!!! I don't want to have to recreate ev
-
JMS transport warning when start server
When I start a WebLogic 9 server instance with one application deployed, I get the following warning message 5-6 times before the server changes its state to RUNNING: <WSEE>Warning: JMS queue 'weblogic.wsee.DefaultQueue' is not found, as a result, We
-
Getting adobe form file size at run time
hi, ya i need the adobe form file size at run time. my requirement is to get xstring and file size of the adobe form. adobe form format is already in xstring format, but how to get the file size.
-
Enhancement to add userdefined fields for standard definition in cj20n
Hi all sub:enhancement to add userdefined fields in a user defined screen tab for standard definition in t-code cj20n can anyone provide an idea how to write the logic for retriving the data from the standard table into the user defined screen added
-
Use of "overflow:auto" in a div vs a table
Pest is back. I am building pages where there are potentially VERY long tables, and I only want them to take up "X"px of vertical space. Using a <div> to surround the table, adjusting the height and width of the <div> to whatever I want has been VER