Need to update a column in a table to another table
I followed two tables() PP_TAX
BAN NUMBER (9),
FEATURE_CODE TANK (6 BYTES),
FTR_REVENUE_CODE TANK (3 BYTES),
TAX_CALC_METHOD CHAR (1)
)
() CHARGE_INFO
FEATURE_CODE TANK (6 BYTES),
FTR_REVENUE_CODE TANK (3 BYTES),
TAX_CALC_METHOD CHAR (1)
)
First PP_TAX table is a temporary table. I inserted the values of the 3 columns (BAN, feature_code and FTR_REVENUE_CODE). And now I want to update this table TAX_CALC_METHOD column by using the CHARGE_INFO table.
I need to compare feature_code & FTR_REVENUE_CODE of the columns of the tables, and update the values in the PP_TAX table.
Kindly help
Paragraphs
Welcome to the forum.
Are you like?
CREATE TABLE PP_TAX (
BAN NUMBER(9),
FEATURE_CODE CHAR(6 BYTE),
FTR_REVENUE_CODE CHAR(3 BYTE),
TAX_CALC_METHOD CHAR(1)
);
CREATE TABLE CHARGE_INFO(
FEATURE_CODE CHAR(6 BYTE),
FTR_REVENUE_CODE CHAR(3 BYTE),
TAX_CALC_METHOD CHAR(1));
INSERT INTO PP_TAX(BAN, FEATURE_CODE, FTR_REVENUE_CODE)
VALUES (1,'AAAAAA','BBB');
INSERT INTO CHARGE_INFO(FEATURE_CODE, FTR_REVENUE_CODE,TAX_CALC_METHOD )
VALUES ('AAAAAA','BBB','U');
COMMIT;
UPDATE PP_TAX P SET P.TAX_CALC_METHOD = (SELECT TAX_CALC_METHOD FROM CHARGE_INFO CC
WHERE CC.FEATURE_CODE=P.FEATURE_CODE
AND P.FTR_REVENUE_CODE=CC.FTR_REVENUE_CODE)
COMMIT;
select * from PP_TAX;
Tags: Database
Similar Questions
-
How update the column in the table based on the value selected in apex4.1
Hi all
I have the following tables,
and it has the values as follows,leave_type table,it has the following fields, 1.emp_name, 2.sick 3.casual
leave_master table and it includes the following fieldsemp_name sick casual guru 10 10 mishra 10 10
I have the form based on the table "leave_master"1.emp_name, 2.leave_type 3.no_of_days
Here, the leave_type has the LOV which includes.
sick and casual.
When the form is filled out and clicked on the button submit,
I need to update the column leave_type in table leave_type,
for example,.
then I want to update the leave_type column,if emp_name:guru leave_type:sick no_of_days:3
sick sick = - no_of_days for the 'guru' of name
That is to say, ill = 10-3 = 7
then the leave_type of the table must be,
someone can such me what code or method I can use?emp_name sick casual guru 7 10 mishra 10 10
Thank you.
Published by: Gurujothi on May 24, 2012 21:54
Published by: Gurujothi on May 24, 2012 21:54Try something like this...
BEGIN
IF: PXX_LEAVE_TYPE = "Sick" THEN
UPDATE LEAVE_TYPE
THE PATIENT VALUE = SICK -: PXX_NO_OF_DAYS
WHERE EMP_NAME =: PXX_EMP_NAME;
ON THE OTHER
UPDATE LEAVE_TYPE
DEFINE CASUAL = CASUAL -: PXX_NO_OF_DAYS
WHERE EMP_NAME =: PXX_EMP_NAME;
END IF;
COMMIT;
END; -
Update multiple columns from multiple tables in a single UPDATE request
Hello
I'm trying to figure if I'm heading in the right direction.
I want to update multiple columns from multiple tables in a single UPDATE request. Also, I would like to update multiple columns in a table from the tables.
Scenario 1
UPDATE Table2, Table 3 SET T2.Column1 = T1.Column1 ,T2.Column2 = T1.Column2 ,T3.Column2 = T1.Column2 FROM Table1 T1, Table2 T2, Table3 T3 WHERE T1.id = T2.id and T1.id = T3.id
Scenario 2
UPDATE Table3 SET T3.Column1 = T1.Column1 T3.Column2 = T1.Column2 ,T3.Column3 = T2.Column3 ,T3.Column4 = T2.Column4 FROM Table1 T1, Table2 T2, Table3 T3 WHERE T3.id = T1.id and T3.id = T2.id
Hello
For scenario 1, you must write separate instructions UPDATE table2 and table3.
To guard against someone else change one of these tables while you act so you can copy all relevant data in a global temporary table and update this global temporary table table3.
ENGAGE only when two tables have been changed.
You can write a procedure or an INSTEAD OF trigger to do all this.
For scenario 2, you can reference many tables that you need when new table3. It might be more efficient and simpler to use the MERGER rather than UPDATED. For example:
MERGE INTO table3 dst
WITH THE HELP OF)
SELECT t1.id
t1.column1
t1.column2
t2.column3
t2.column4
FROM table1 t1
JOIN table2 t2 ON t1.id = t2.id
) src
WE (dst.id = src_id
WHEN MATCHED THEN UPDATE
SET dst.column1 = src.column1
dst.column2 = src.column2,
dst.column3 = src.column3,
dst.column4 = src.column4,
;
-
Automatically update the column in the table in OBIEE
Hi people,
I have a requirement to say I need to update a column of table based on a condition, but this update should happen on a daily basis (I mean that it would be held once per day) by checking if all the records in this column meets the condition then update
example:-column = 'pending', then using the "approved". As records of transactions every day in the table lights. OBIEE should check and update the line so the next time it does not show this line as "pending".
I thought of 2 approaches to this
(1) through the write-back, it is possible to update but manually (the question is it can't be automated or on demand on daily basis and update multiple records on a go)
(2) write a stored procedure or a function of update, but how can I perform this procedure either regular or run once daily.how to use it?
Any thoughts on the above two points or any method you can think off the coast.
Any help is appreciated!
See you soon,.
KKMurielle,
This shud be easy...
-Create a direct database... with the Update statement
for example: Update table set col = "Approved" where col = 'pending '.
-Create an ibot using the RFI above and plan on a daily basis.This will update the complete table with the new value on a daily basis based on the State
-
Select cursor for update: multiple columns of different tables
Hello
I have two tables test1 and test2. I want to udpate the column (DEPT_DSCR) from the TEST1 and TEST2 using select for update and current tables of the... with the cursor.
I have a code drafted as follows:
DECLARE
v_mydept1 TEST1. TYPE % DEPT_CD;
v_mydept2 TEST2. TYPE % DEPT_CD;
CURSOR C1 IS SELECT TEST1. DEPT_CD, TEST2. DEPT_CD OF TEST1, TEST2 WHERE TEST1. DEPT_CD = TEST2. DEPT_CD AND TEST1. DEPT_CD IS 'AA' FOR THE UPDATE OF TEST1. DEPT_DSCR, TEST2. DEPT_DSCR;
BEGIN
OPEN C1;
LOOP
FETCH C1 INTO v_mydept1, v_mydept2;
WHEN EXIT C1% NOTFOUND;
UPDATE TEST1 SET DEPT_DSCR IS "PLSQL1" WHERE CURRENT OF C1;.
SETTING A DAY TEST2 SET DEPT_DSCR = 'PLSQL2' WHERE CURRENT OF C1.
END LOOP;
COMMIT;
END;
The code above when it is run, declares that it runs successfully. But it does not update the columns you want [DEPT_DSCR].
It works only when we want to update one or more columns of the same table... i. e by providing these columns after ' to UPDATE THE.
I don't know what exactly is the problem when you want to update several columns of different tables.
Can someone help me on this?user12944938 wrote:
But it's more the notion of compensation and understanding.See the link below:
http://download.Oracle.com/docs/CD/B10501_01/AppDev.920/a97269/pc_06sql.htmSee the section RESTRICTION in the link above.
Twinkle
-
How to update exists column on the table with the exact number and auto increment
Hello
I have a table with more than 10 million rows and there is a column called 'number_zaq', I want to update this column on line frist from 2000 and + 1 for the next all ranks.
Update your_table
Set number_zaq = rownum + 2000-1;
-
InStr/substr logic to update the column in a table db 9i / 10g / 11g
Hi all
I have a table Test_table with email_address column.
Please update the table and remove
[email protected] and
[email protected]
email_address column.
Current values of the Email_address column
[email protected], ken. [email protected], [email protected], [email protected]
2.Ken. [email protected], [email protected], [email protected]; [email protected]
3 ken. [email protected], [email protected], [email protected], [email protected]
The new value must be
1 ken. [email protected], [email protected]
Ken 2. [email protected], [email protected], [email protected]
3 ken. [email protected], [email protected]
If email_address to remove is the first email address in the column
Then, remove the first comma too, otherwise delete the comma above and email address.
I created a C1 cursor, but I know is not the logic to use to get the new value
Any help will be greately appreciated.
Declare
Cursor c1 is select rowid, email_address
From Test_table
Where (at the top (email_address) like ('% [email protected]%'))
GOLD (superior (email_address) like '% [email protected]%');
V_new_email varchar2 (200);
BEGIN
FOR rec IN C1 LOOP
-do not know how to handle V_new_email to be able to update the table with the current values.
V_new_email: = - some function instr/substr here
Update Test_table
Define email_address = V_new_email
Where rowid = rec.rowid;
END OF LOOP
END;
Thank youYou needn't PL/SQL for such a thing. A SQL should be sufficient.
with data as ( select '[email protected], [email protected], [email protected], [email protected]' col from dual union all select '[email protected], [email protected],[email protected]; [email protected]' from dual union all select '[email protected], [email protected], [email protected], [email protected]' from dual ) select col, trim(replace(replace(replace(col, '[email protected],'), '[email protected]'), ', ,', ',')) rep_col from data; COL REP_COL -------------------------------------------------------------- -------------------------------------------------------------- [email protected], [email protected], [email protected], [email protected] [email protected], [email protected] [email protected], [email protected],[email protected]; [email protected] [email protected], [email protected],[email protected]; [email protected], [email protected], [email protected], [email protected] [email protected], [email protected], [email protected]
-
When the need to update the statistics for a table
In Sybase, we use "delete the statistics', 'update all statistics" and 'sp_recompile', fact Oracle need to do such things anyway? Thank you!
Given that the V10 by default Oracle collects "necessary" statistics (new) once every 24 hours.
If you determine that your situation requires a different treatment, so you must do manually what you feel is appropriate.
-
need to trigger when updating a column then sysdate record on another column
Hello
Gurus
I have a table named RTV_PLAN
And it has two columns,
FORCE_KEYIN_FLAG VARCHAR (2)
DATE OF FORCE_KEYIN_DATE
I want when FORCE_KEYIN_FLAG get a value
Then FORCE_KEYIN_DATE save the sysdate
Please kindly give help
Thank you very much
SavenFlorian wrote:
You can check out what they have another error?Relaxation compile? I don't see obvious syntax errors. If you get a compile error, see the error.
What is the trigger that is supposed to do? It is impossible for anyone to tell you if your trigger does what you want it to do. You would have to tell us what it is supposed to do. Since you have the tables and the application of the APEX in question, you would have to tell us if it does not have what you want in some specific cases.Justin
-
Update updated the columns with null are excluded from the DB adapter
Hi all
My fusion system interacts with DB2 using the DB adapter.
I have a script that I need to update a flag in the table after completing my bpel workflow. But by updating the value of indicator to "Processsed", there are other columns with a NULL value.
How to solve this problem. I don't want to do, the other columns should not be alerted.
Thank you
Richa
Hello
The issue has been resolved. In fact, I've updated the update statement, excluding items that couldnot be updated top link mappings. I had to create a new adapter and it worked.
Concerning
-
How can I update the column 1st day of each month
Hello
I have an Emp table with the following columns
now it has the following features,1.Emp_name varchar2(50), 2.Days number(3).
Now I need to update the column 'Days' 20 for emp_name all whenever the date is the first day of the monthEmp_name Days Mishra 11 David 15 Raju 18
IE June 1, 2012 July 1, 2012 and so on.
How can we do?
can someone help me.
Thank you.Look for the DBMS_SCHEDULER package.
Kind regards
-
Add new columns to iExpense Table of Adv. finished Non-Employee Information
I have a requirement where in I need to add three columns to the table in iExpense DetailsPG at the table of the advanced non-employee information (GuestTableRN). I was able to add three areas through customization (I know that this can be done by extending the CO, but tried through customization)
If there was DFFs, it would have been easy, but there is no DFFs.
I created a table with the columns attendee_line_id and report_line_id that are also in the oie_attendees_all table. Then next created the necessary business components, first OS based on the table custom and then expanded the VO on the page, ExpAttendeesVO and also added the custom to the VO EO.
I put the code in the java VoImpl extended to insert or delete lines and moved these files on the server, insert data into the table manually. The data is displayed in the three new Non-employee table columns. I was able to update the existing data on the details page. But I can't do an insert or delete it from the page.
I need suggestions on how to address this issue.
Thank you
KishoreHi Kishore,
You cannot update two tables using an EO (even if you extended it). What I propose is to write PLSQL API and call that could insert data into your custom table. Another option is to write a trigger on your table planted (on insert) and check for certain key conditions based on which you can insert data into your custom table.
Concerning
Sumit -
Addictional columns in the TABLE of $ J
Hello
I need to store additional columns in the TABLE of $ J.
The reason is:
I build summaries on the tables of my target. The target table does not contain the primary key of the source table.
He is allowed to delete the data on the source table and in this case, the process must recalculate the summaries. The problem is I know that the primary key of the record deleted on the source tables and I can't recognize what summaries I have to recalculate.
My idea is to use additional columns for a updated key in the ARRAY $ J that would be filled if the record has been deleted.
Any better idea? How could I add some columns of addition to the TABLE of $ J?
Thank you
MarcinOK, so,.
J$ Table is created by the Journal to create the JKM, stage
By changing some settings, you can add some information set by Oracle.You can change 2 things to recover more than the PK.
-First of all to the JKM, Journal created in step: change the value of the Capture_values parameter to "both."
--> This will retrieve the rows in table 2 J$ for an update (UU as the old value) and the United Nations as the new value and integer values for Delete and Insert.-You must now change the JV$ and JV$ D views in order to group the 2 lines for the updates.
I think that's what you need, if I understand.
Brice
-
SQL-modify the columns in a table
I need to change a column in a table exiciting in production,
What are the steps I need to follow before using below command
ALTER TABLE table_name modify column_name data_Type;Hello
If you want to increase the size that existing then you can try what you did...
You cannot change datatype below what - this current...
SQL> alter table test modify emptype varchar2(30); Table altered.
-
How to search all columns of all tables in a database
I need to search all columns of all tables in a database, I already write the code below, but I got the below error message when running this script
DECLARE
The CNT number;
v_data VARCHAR2 (20);
BEGIN
v_data: = "5C4CA98EAC4C";
FOR t1 IN (SELECT table_name, column_name FROM all_tab_cols where owner = 'admin' and DATA_TYPE = 'VARCHAR2') LOOP
RUN IMMEDIATELY "SELECT COUNT (*) FROM" | T1.table_name | 'WHERE ' | T1.column_name | ' =: 1' IN cnt USING v_data;
IF cnt > 0 THEN
dbms_output.put_line (t1.table_name |) » '|| T1.column_name | | » '|| CNT);
END IF;
END LOOP;
END;
/
Error report:
ORA-00933: SQL not correctly completed command.
ORA-06512: at line 7
00933 00000 - "not correctly completed SQL command.
* Cause:
* Action:
Any help pleaseIf you are running this as a different user than the ADMIN you will also need to add the schema name.
EXECUTE IMMEDIATE 'SELECT COUNT(*) FROM ' ||t1.owner||'.'||t1.table_name|| ' WHERE ' ||t1.column_name || ' = :1' INTO cnt USING v_data;
The error could be any strange names of tables or columns. For example, if they contain spaces in the name.
If you have names, then all identifieres must be placed in "."+ untested example +.
{code}
RUN IMMEDIATELY "SELECT COUNT (*) FROM" ' | "" T1. Owner: ' ». » ' || T1.table_name | " » OÙ « ' || T1.column_name | "" =: 1' IN cnt USING v_data;
{code}
Maybe you are looking for
-
Mac FIrefox 20.0 some Web sites won't load not
I am running 20.0 Firefox on my Mac. My operating system is OS X 10.8.3. Some sites Web does very well. Some are starting to load up, but never end. The color wheel spins and I have to force quit. AMERICAblog is an example of a site that does not loa
-
E - 350 chokes on Netflix HD X120e. Any ideas?
Hello As noted above. Computer is completely up-to-date, but still not manage the buffer rate of Netflix HD. video is choppy and bleachers and audio is out of sync. Even that it's on battery or plugged in. Any ideas on how to solve this problem? Than
-
Hello! It is not so easy as it sounds because I think I messed up something... I had XP, then it became boring and useless, so I decided to "Reinstall" my pc. I wanted to - get the new XP pro without any information on my computer, like new. After I
-
How can I burn an Album from Windows Media Player on a blank CD
When I burn an Album from Windows Media Player in Windows 7 on a blank CD, I can not play the CD on a CD player, I can play on the computer. In other words, I can not finalize the disc. When a burn the Album on the disc, the disc is ejected and I don
-
Hi, I have cisco ACS 5.2 and you want to create the user account of technician, with only some commands. How can I achieve this? Thank you