Copy column to another column in the same table
HelloWork on the Version of the EBS: 11.5.10.2
Table name: ASO_QUOTE_HEADERS_ALL
COLUMNS:
NUMBER OF QUOTE_STATUS_ID
ATTRIBUTE6 VARCHAR2 (240 BYTE);
Need to copy quote_status_id to attribute6 for this quote_header_id
example, if quote_status_id = 10, then he must copy in attribute6 = 10 quote_header_id = 69312
Yet once if changed to quote_status_id = 10077 should replace by attribute6 = 10077
for quote_header_id = 69312
I've written a procedure posted below:
CREATE or REPLACE procedure SLC_STATUS_CAPTURE (p_quote_header_id number) is
BEGIN
UPDATE aso_quote_headers_all SET attribute6 = quote_status_id
WHERE quote_header_id = p_quote_header_id;
end SLC_STATUS_CAPTURE;
before calling this trigger through table-level
BEGIN
SLC_STATUS_CAPTURE(:OLD.) QUOTE_HEADER_ID);
END;
It gives an error.
Please I need help.
Thanks and greetings
Vijay
As others have mentioned, you cannot change the column values in a statement-level trigger. In addition, you cannot update that triggers the trigger on the table. If I understand correctly, you want to copy the value of quote_status_id in attribute6, when a row is inserted or updated. If that is correct, then you need only simple as tripping:
create trigger trigg
before insert or update of aso_quote_headers_all
for each row
begin
:new.attribute6 = :new.quote_status_id;
end;
John
Tags: Database
Similar Questions
-
Make a column based on another value of the column in the same table
JDev 11.1.1.6.0
It may be a silly question but I'm stuck
I need to conditionally return a column that said Condition is as if the value in the other column of the same table B is equal to F. I should make A column only when this condition is met. I tried the following code:
< af:column sortProperty = "PhoneNumber1." sortable = "false". headerText = "#{bindings." A.hints.PhoneNumber1.label}. ID = "c146. rendering = "#{rank." PhoneNumber1ResponseFlag eq 'F'} ">" < af:outputText value = "#{rank." PhoneNumber1}. ID = "ot130" / > < / af:column > < af:column sortProperty = "PhoneNumber1ResponseFlag." sortable = "false". headerText = "#{bindings." B.hints.PhoneNumber1ResponseFlag.label}. ID = "c80" rendered = "true" > < af:outputText value = "#{rank." PhoneNumber1ResponseFlag}. ID = "ot129" / > < / af:column > The data presented in the table for the PhoneNumber1ResponseFlag column are F. Still my condition does not work.
Well, I've finally sorted it myself by managed bean.
Here are the steps I followed:
- Wrote a new bean managed.
- Added a Boolean variable called flag and made to true when the "'PhoneNumber1ResponseFlag ' current line attribute is equal to F."
- Changing the property made column on this indicator.
-
Question: Is foreign key references to a different column in the same table
Hello
I'm not grasp this concept. Would you be able to provide the logic how and why you need to create a foreign key that references a column of the same table?
For example, referencing the schema, SupervisorNo @ here is a FOREIGN KEY to the "EmpNo" column in the same table.
EMPLOYEE (EmpNo, title, Fname, Lname, phone, Email, date of birth, sex, salary, HireDate, OutNo, SupervisorNo @)
Why would you want to do this and how can it be used? If you are filling out the data in the table, and this constraint is enabled, you will not be able to load whatever it is because the "EmpNo" column will be empty.
Any input you can provide me with this would be greatly appreciated. Thank you!
His name
Self-referential integrity constraints
Lets say that we have the table emp with emp_no and mgr_no columns.
Now all managers should also be an employee too. How can I check this when inserting data into this table? I applied auto integrity constraint. It would help me to make sure no handler (doesn't mean no mgr_no) must be registered if this Manager is not an employee of this organization. Which means, I won't be able to enter any mgr_no in the column until and unless that the same employee also is an employee (emp_no from the same table).
Check the link as well below.
Thank you
Ishan
-
Comparison of columns in the same Table, with the exception
Hi all
I need compare two values of column in the same table. But should ignore a few characters like space, comma, point
Following should be consistent
How is it possible'ABcd f' = 'AbCDf' 'xyz ..' = 'xy z'
See you soon
Sexywith t as ( select 'ABcd f' col1,'AbCDf' col2 from dual union all select 'xyz ..','xy z' from dual union all select 'xyz ..x','xy z' from dual ) select * from t where upper(translate(col1,'a ,.','a')) = upper(translate(col2,'a ,.','a')); COL1 COL2 ------- ----- ABcd f AbCDf xyz .. xy z
Published by: JAC on 4 February 2013 17:22
-
Can we have hash partition and list on 2 columns in the same table. How.
Can we have hash partition and list on 2 columns in the same table. How.
Work on 10g release 2# List-Hash is a valid composite partitioning strategy 11 from g.
-
Update the same column in the same table
Hello
How do update you a records of column in the same table?
I have purchase_order of the table. Consists of column ID, color, Purchase_No, Sub purchase.
< pre >
Create table Purchase_Order)
Identification number,
color varchar2 (10),
purchase_No varchar2 (5).
purchase_sub varchar2 (2));
< / pre >
< pre >
ID color Purchase_No purchase Sub
6416 S1406 PURPLE 3
6415 S1406 GREEN 2
6414 S1406 GREEN 1
6419 S1406 3
6417 S1406 1
6418 S1406 2
< pre >
6 unique ID records is in the same site. But 2 ID will be confined to a purchase_sub.
For example
6416,6419 purchase_no S1406 but has the same purchase_sub who need 3.I 6419 color "Purple".
Expected results:
< pre >
ID color Purchase_No purchase Sub
6416 S1406 PURPLE 3
6415 S1406 GREEN 2
6414 S1406 GREEN 1
6419 S1406 PURPLE 3
6417 S1406 GREEN 1
6418 S1406 GREEN 2
< / pre >
Thank you!
Published by: CrackerJack on May 4, 2009 15:04Hello
Try this,
UPDATE Purchase_Order a SET a.Colour = (SELECT colour FROM Purchase_Order b WHERE a.Purchase_Sub = b.Purchase_Sub AND b.colour Is Not Null) WHERE a.Colour Is Null
Kind regards
Christian Balz -
Copy the value1 to value2 column column in the same table
Hi all
If I want to update the values in column 2 stack with stack column. It's the same table 'Data_GU '.
RACK_ID STACK STACK2
S1009 706161522 S8322
S1009 706168051 S8322
S1009 706116417 S8322
S1009 706126698 S8322
I came with
UPDATE DATA_GU C
SET STACK2 =)
SELECT battery
OF DATA_GU B
) ;
I have an error returns unique lines and more than one line... How to on this subject. Thank you guys.UPDATE DATA_GU SET STACK2 = STACK /
SY.
-
Conflicts of SQL columns on the same table
I have a table with two columns used for the same purpose. Examples (start_date and career_history_start) (end_date or career_history_end).
The columns have different (varchar2 and date) data types. The developer has used the data type date (start_date) to write the report and of the use of time even the vachar2 to manully insert date. We decided to use a single (varchar2). Meanwhile, there are differences in the two columns. We will find the difference between the two columns start_date (date) and career_history_start (varchar2).
No idea what query will accomplish this considering they gave different type on the same table?
Here is the description of the table:
career_history / / DESC
Name of Type Null
--------------------------- -------- -------------
CAREER_HISTORY_ID NOT NULL NUMBER (38)
PERSON_ID NUMBER (38)
CAREER_HISTORY_START VARCHAR2 (50)
CAREER_HISTORY_END VARCHAR2 (50)
CAREER_HISTORY_DESC VARCHAR2 (250)
CAREER_HISTORY_RECNUM NUMBER (38)
Start_date DATE
End_date DATE
CAREER_HISTORY_ACTIVE_FLAG CHAR (1)
CAREER_HISTORY_DELETED_FLAG CHAR (1)
CAREER_HISTORY_UPDATE_TIME TIMESTAMP (6)
CAREER_HISTORY_UPDATED_BY VARCHAR2 (50)
NUMBER OF SORT_NUMThe customer doesn't care how the data is stored in the database. He care how it is displayed.
What happens if your client has another office in a zone schedule differnet and each office needs display their time locally, but the server must store all the time in the same zone. How do they manage that when storing dates as a varchar data type. You get that kind of built-in functionality when you use a date data type
In its simplest form if the customer is always display the data as a string, and then create a view from top of the table and convert dates in any format the customer prefers and that expose to the client.
In this way, you get data stored properly and the client allows you to view data in the way they prefer
-
place a select query calculation in a different column in the same table
How can I put my calculation result in a column named within the same table?
I have a table called: dgpercentagedatachart
I use the columns of this dgpercentagedatachart: totalcecrating divided by lowestfeederrating times 100 to get the percentage
In the query, I gave the result the Alias of the cal
What I want is to put this result in my application or my calculation (in percentage) in my column "percent" on my table of dgpercentagedatachart vacuum.
How can I configure this syntax?
This is the select query, I came with:
Select dgpercentagedatachart.totalcecrating, dgpercentagedatachart.lowestfeederrating,.
100.00*dgpercentagedatachart.totalcecrating/dgpercentagedatachart.lowestfeederrating as cal
of dgpercentagedatachart;
Here are the results:
CAL lowestfeederrating Totalcecrating
8,978 7.48166666666666666666666666666666666667 120
30.951 25.7925 120
5.04 120 4.2
Hello
2685870 wrote:
How can I put my calculation result in a column named within the same table?
I have a table called: dgpercentagedatachart
I use the columns of this dgpercentagedatachart: totalcecrating divided by lowestfeederrating times 100 to get the percentage
In the query, I gave the result the Alias of the cal
What I want is to put this result in my application or my calculation (in percentage) in my empty column '%' on my table of dgpercentagedatachart .
How can I configure this syntax?
This is the select query, I came with:
Select dgpercentagedatachart.totalcecrating, dgpercentagedatachart.lowestfeederrating,.
100.00*dgpercentagedatachart.totalcecrating/dgpercentagedatachart.lowestfeederrating as cal
of dgpercentagedatachart;
Here are the results:
CAL lowestfeederrating Totalcecrating
8,978 7.48166666666666666666666666666666666667 120
30.951 25.7925 120
5.04 120 4.2
To change an existing column in a table, you can use the UPDATE or MERGE, instructions like this:
UPDATE dgpercentagedatachart
Percentage of VALUE = 100,00 * totalcecrating
/ lowestfeederrating
;
Noramlly, tables is not redundant columns like this. If percent can always be calculated from other columns, then it is probably better to calculate at run time and store it in the database, where you will have to be updated each time the columns it depends on change. You can use a view to avoid having to encode them the calculation.
If you really don't want a column that can be calculated in the same lines other columns, then use a virtual column (if you use Oracle 11 or higher).
I hope that answers your question.
If this isn't the case, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
If you ask on a DML statement, such as UPDATE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or the tables changed when it's all over.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: Re: 2. How can I ask a question on the forums?
-
related fact table column reference the same table dim
In my analytical field, my fact table related reference column the same dim table, but in a physical schema, between two tables can have a join, so I create a copy of the Sun table, then finish the join in physics. This method can solve this issue, but not very good, someone at - it a perfect solution?You must create aliases for table dim, not just a copy. Why does it resolve the issue?
-
Hello forum!
I kinda made a mistake. I hope someone can answer me this.
I have a folder under "Records" in the library. In this folder, I have 62 photos, which are also edited in lightroom.
A mistake that happened and I've added a new folder containing the same images, but there is more than 200 pictures in this folder.
Is it possible to copy my photos modified in my catalog to the new folder?I hope that the question was not confusing.
Thank you!
If you have two folders, which contains identical images, then you have the duplicate hard disk files.
In this case, you will not be able to move the images published in the largest file because the file on any computer system will not allow that.
Copy of the parameters is not the answer because that can be done individually (assuming that all the files have not the same settings)
Identify files duplicate in the large folder and delete them from your hard drive. You can do this in Lightroom by pressing the DELETE key and choosing the option remove the disc (not delete)
Select all 62 images in the grid, and then drag them to the folder you want to move them. Lightroom invite you you move them on the hard drive also. Ok.
Let us know if this helps
-
Need a script to select the update the row to another row in the same table
I have a table with the columns and values
I need to update the InactiveDate of a line with the EffectiveDate of a line with the EffectiveDate newer than the update line and the even KeyID.KeyID EffectiveDate InactiveDate 1 01/01/2013 1 01/02/2013 1 01/03/2013 2 12/31/2012 2 01/02/2013 2 01/03/2013
I want to have a select script that showsKeyID EffectiveDate InactiveDate 1 01/01/2013 01/02/2013 1 01/02/2013 01/03/2013 1 01/03/2013 2 12/31/2012 01/02/2013 2 01/02/2013 01/03/2013 2 01/03/2013
Thanks for any help.KeyID EffectiveDate InactiveDate New_InactiveDate 1 01/01/2013 01/02/2013 1 01/02/2013 01/03/2013 1 01/03/2013 2 12/31/2012 01/02/2013 2 01/02/2013 01/03/2013 2 01/03/2013
Published by: 881656 on January 3, 2013 17:57
Published by: 881656 on January 3, 2013 18:15
Published by: 881656 on January 3, 2013 18:20Hello
881656 wrote:
I have a table with the columns and valuesKeyID EffectiveDate InactiveDate 1 01/01/2013 1 01/02/2013 1 01/03/2013 2 12/31/2012 2 01/02/2013 2 01/03/2013 I need to update the InactiveDate of a row with the EffectiveDate of a row with the newer EffectiveDate than the row to be updated and with the same KeyID. KeyID EffectiveDate InactiveDate 1 01/01/2013 01/02/2013 1 01/02/2013 01/03/2013 1 01/03/2013 2 12/31/2012 01/02/2013 2 01/02/2013 01/03/2013 2 01/03/2013
This sounds like a job for the analytical function of LEAD:
MERGE INTO table_x dst USING ( SELECT keyid , effectivedate , LEAD (effectivedate) OVER ( PARTITION BY keyid ORDER BY activedate ) AS inactivedate ) src WHEN MATCHED THEN UPDATE ON ( src.id = dst.id AND src.effectivedate = dst.effectivedate ) SET dst.inactivedate = src.inactivedate ;
I want to have a select script which shows KeyID EffectiveDate InactiveDate New_InactiveDate 1 01/01/2013 01/02/2013 1 01/02/2013 01/03/2013 1 01/03/2013 2 12/31/2012 01/02/2013 2 01/02/2013 01/03/2013 2 01/03/2013
Once that you have done the above MERGER, it is simply:
SELECT * FROM table_x ORDER BY keyid , effectivedate ;
If you do not have sthe FUSION, then see the query in the USING clause of the MERGER.
I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and the results you want from this data.
In the case of a DML (UPDATE), for example, the sample data should show what looks like the tables before the DML, and the results will be the content of the table changed after the DML.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002} -
the row_number() value another column in the same table
Hi all
I have NODE_DETAILS which has following of table columns
MSLINK
NODE_ID
RNUM
I update RNUM with row_number() value in ordering the mslink. I tried after update statement
Update)
Select / * + bypass_ujvc * / rnum has, row_number() over (order of mslink) NODE_DETAILS rrnum
)
set a = rrnum
But he throws ORA-01732: non-legal data manipulation operation on this display error
How can I update row_number() rnum column?
Thank you
SujnanYou can use MERGE
SQL> create table node_details 2 (mslink number 3 ,node_id number 4 ,rnum number 5 ) 6 / Table created. SQL> SQL> insert into node_details 2 select -rownum, rownum, null 3 from all_objects 4 where rownum <= 5 5 / 5 rows created. SQL> SQL> select * 2 from node_details 3 ; MSLINK NODE_ID RNUM ---------- ---------- ---------- -1 1 -2 2 -3 3 -4 4 -5 5 SQL> SQL> merge into node_details n 2 using (select rowid rid,rnum a, row_number() over (order by mslink) rrnum from NODE_DETAILS) v 3 on (v.rid = n.rowid) 4 when matched then 5 update set rnum = rrnum 6 ; 5 rows merged. SQL> SQL> select * 2 from node_details 3 ; MSLINK NODE_ID RNUM ---------- ---------- ---------- -1 1 5 -2 2 4 -3 3 3 -4 4 2 -5 5 1 SQL> SQL>
-
How to get the difference of current and previous line for a column of the same table?
Hello
I have a table where there are 3 rows and say 2 columns only, as below
Col1 | Col2
--------------------- |----------------------------------------first_flag | 100
second_flag | 104
third_flag | 110
Now, using sql, which accepts a parameter col1, how do I get the bottom o/p
say that the entry is second_flag,
output must be
second_flag, 104, 4 (4 being the difference between 104 and 100)
If I give the entry like third_flag, the output should be
third_flag, 110, 6 (6 is the difference between 110 and 104)
Any help?
Hello
Another way is to use the analytic LAG function:
WITH got_diff AS
(
SELECT col1, col2
, col2 - LAG (col2) over (ORDER BY col1) AS diff
OF mydata
)
SELECT *.
OF got_diff
WHERE col1 =: flag_wanted
;
This assumes that the lines are in alphabetical order by col1. If the order is something else, then use it in the ORDER BY clause analytical.
-
With the help of table 'helper' to fill the 2 different columns in the same table
I have a table that contains two columns that use abbreviations that I want to join to another table "assistance" that develops on what mean these abbreviations. I have my query to display the full name of these abbreviations, rather than the abbreviated name.
For example,.
Table 1
Name acronym
====== ======
MY Monday
KILL Tuesday
WEDNESDAY Wednesday
Table 2
Entry day due date
====== ======
LUN MAR
MAR SEA
SEA OF LUN
I want to create a query that will show you:
Entry day due date
====== ======
Monday Tuesday
Tuesday, Wednesday
Wednesday Monday
I can get it to map a column, but not both. Any help?Assuming that you really do need the table of the acronym (i.e. Oracle includes functions to translate date abbreviations).
SELECT a.full_name entry_date, b.full_name due_date FROM table1 a, table1 b, table2 c WHERE a.acronym = c.entry_day AND b.acronym = c.entry_day
Justin
Maybe you are looking for
-
Satellite A300 - no activity after the Toshiba homepage
I have a weird question I have not met before. When the laptop is turned on, you get the Toshiba splash screen, pressing f2 gets you into BIOS, f12 allows to you in the start menu, both these menus work fine. However, no matter what happened it just
-
Email for blackBerry Smartphones application is greyed out on BlackBerry desktop software.
I have the Blackberry desktop software version 4.5 installed on my computer. I can't access the E-mail application because it is grayed out. When I try to access it I get an error message "this computer does not have his account address message. The
-
Win7 / product key should be activated in the next few days
New HARD drive. Used Win7 disk and product key on the box of the initial purchase of the computer. Now Win7 says that I have a few days to activate it. I lose Win7 in one week?
-
How to transfer my new Mac Audition CS5.5
I have Adobe Audition CS5.5 on my Mac before. Now I need to transfer to my new Mac.
-
CD/DVD no longer works after update BIOS of yesterday
HP Pavilion dv7-6b55dx Win 7 64 bit I solved the problem with the audio that created the update, but now to discover that my DVD/CD is unusable. I don't see the driver available to replace it. Tried to reinstall the driver I have on my PC and got t