Update multiple columns with case
I have this and I wanted to have it in a single update to the case when then etc. Anyone?
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 11 AND CIITM_CODE = 2;
--8288 lines are updated.
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 2
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 12 AND CIITM_CODE = 2;
-513 lines to date.
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 3
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 13 AND CIITM_CODE = 2;
-39 lines to date.
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 4
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 14 AND CIITM_CODE = 2;
-15 updated lines to date.
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 5
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 15 AND CIITM_CODE = 2;
-5 lines to date.
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 6
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 16 AND CIITM_CODE = 2;
-4 lines to date.
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9, CIITM_NUMIT = 7
WHERE CIITM_APPLICATION = 7 AND CIITM_ITEM_RATE = 17 AND CIITM_CODE = 2;
UPDATE TABLE_NAME
SET CIITM_ITEM_RATE = 9,
CIITM_NUMIT = CASE CIITM_ITEM_RATE
11. WHEN CAN CIITM_NUMIT
OF OTHER CIITM_ITEM_RATE - 10
END
WHERE CIITM_APPLICATION = 7
AND CIITM_ITEM_RATE BETWEEN 11 AND 17
AND CIITM_CODE = 2;
SY.
Tags: Database
Similar Questions
-
UPDATE multiple columns with conditional parameters
I have a procedure that updates several columns of a table using the parameter of the procedure. Is it possible to have a update unique with the parameter SET conditional statement?
Is it possible to replace several IFs code to have only one UPDATE statement with the condition that update the column only if the parameter passed is not null? In the real world scenario, I have more than 3 columns and I do not want to write lots of IF blocks.CREATE TABLE TEMP (POL_NUM NUMBER, OED DATE, TERM NUMBER, TRANS_CD CHAR(2)); INSERT INTO TEMP VALUES (1, '1 AUG 2009', 12, 'NB'); INSERT INTO TEMP VALUES (2, '4 AUG 2009', 12, 'XL'); INSERT INTO TEMP VALUES (3, '2 AUG 2009', 12, 'RN'); COMMIT; CREATE OR REPLACE PROCEDURE TMP_PROC ( pPOL_NUM NUMBER, pOED IN DATE, pTERM IN NUMBER, pTRANS_CD CHAR2) AS BEGIN IF pOED IS NOT NULL THEN UPDATE TEMP SET OED = pOED WHERE POL_NUM = pPOL_NUM; END IF; IF pTERM IS NOT NULL THEN UPDATE TEMP SET TERM = pTERM WHERE POL_NUM = pPOL_NUM; END IF; IF pTRAN_CD IS NOT NULL THEN UPDATE TEMP SET TRANS_CD = pTRANS_CD WHERE POL_NUM = pPOL_NUM; END IF; COMMIT; EXCEPTION WHEN OTHERS THEN NULL; END;
Please help gurus!
Published by: Kuul13 on September 18, 2009 13:26Hello
Maybe this,.
Create OR Replace Procedure TMP_PROC( pPOL_NUM IN Number , pOED IN Date , pTERM IN Number , pTRANS_CD IN Varchar2 ) As Begin UPDATE TEMP SET OED = NVL(POED , OED ) , TERM = NVL(PTERM , TERM ) , TRANS_CD = NVL(PTRANS_CD, TRANS_CD ) WHERE POL_NUM = PPOL_NUM; Commit; Exception When Others Then Null; End;
Kind regards
Christian Balz -
Problems updating multiple columns with a TO... SELECT subquery
Hello
This statement works very well:
UPDATE scott.dept
SET (deptno) = (WITH AS gaga
(SELECT 1
THE DOUBLE)
SELECT DeptNo
GAGA)
/
The second statement gives an error ORA-01767: UPDATE... GAME expression must be a subquery:
UPDATE scott.dept
SET (deptno, dname) = (WITH AS gaga
(SELECT 1,
'CHANGED '.
THE DOUBLE)
SELECT deptno,
DNAME
GAGA)
/
What's wrong? Is this a limitation of Oracle 9i?
Thank you
HeinzHello
It is not fair to Oracle 9; I get the same error in Oracle 11.
Use MERGE instead of UPDATE. (Sorry, I do not have Oracle 9, so I can't test that it works there, but WITH works MERGE in Oracle 10 and 11; no hide or workaround is necessary).If you want to use the UPDATE and you really need to use a WITH clause (and, of course, you don't have in this simple example), you can hide the WITH clause in a view in line, like this:
UPDATE scott.dept SET ( deptno, dname ) = ( SELECT * FROM ( WITH gaga AS ( SELECT 1, ... ) ... ) ) ;
-
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,
;
-
Update multiple records with PHP
Hey,.
I want to update multiple lines with a single click on the submit button.
Unfortunately, it does not work. What's not in the code?
<? php require_once('.. / Connections/ikon.php');? >
<? PHP
If (! function_exists ("GetSQLValueString")) {}
function GetSQLValueString ($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
If (via PHP_VERSION < 6) {}
$theValue = get_magic_quotes_gpc()? stripslashes ($TheValue): $theValue;
}$theValue = function_exists ("mysql_real_escape_string")? mysql_real_escape_string ($TheValue): mysql_escape_string ($theValue);
Switch ($theType) {}
case 'text ':
$theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";
break;
case "long":
case "int":
$theValue = ($theValue! = "")? intval ($TheValue): 'NULL ';
break;
case "double":
$theValue = ($theValue! = "")? doubleVal ($TheValue): 'NULL ';
break;
case "date":
$theValue = ($theValue! = "")? « " ». $theValue. "" "": "NULL";
break;
case "set":
$theValue = ($theValue! = "")? $theDefinedValue: $theNotDefinedValue;
break;
}
Return $theValue;
}
}$editFormAction = $_SERVER ['PHP_SELF'];
If (isset {}
$editFormAction. = « ? ». htmlentities($_SERVER['QUERY_STRING']);
}for ($j = 0, $len = count($_POST['id']); $j < $len; $j ++) {}
If ((isset($_POST["MM_update"])) & & ($_POST ["MM_update"] == "openingsuren_wijzigen")) {}
$updateSQL = sprintf ("UPDATE ikon_openingsuren SET dag = %s voormiddag = %s, namiddag = WHERE id = %s %s",
GetSQLValueString ($_POST ['dag'] [$j], "text").
GetSQLValueString ($_POST ['voormiddag'] [$j], "text").
GetSQLValueString ($_POST ['namiddag'] [$j], "text").
GetSQLValueString ($_POST ['id'] [$j], "int"));@mysql_select_db ($database_ikon, $ikon);
$Result1 = mysql_query ($updateSQL, $ikon) or die (mysql_error ());
}
}@mysql_select_db ($database_ikon, $ikon);
$query_rsWijzigOpeningsuren = "SELECT * from ikon_openingsuren";
$rsWijzigOpeningsuren = mysql_query ($query_rsWijzigOpeningsuren, $ikon) or die (mysql_error ());
$row_rsWijzigOpeningsuren = mysql_fetch_assoc ($rsWijzigOpeningsuren);
$totalRows_rsWijzigOpeningsuren = mysql_num_rows ($rsWijzigOpeningsuren);
? >
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" > ""
"< html xmlns ="http://www.w3.org/1999/xhtml">".
< head >
< meta http-equiv = "content-type" content = text/html"; charset = utf-8 "/ >"
< title > < / title >
< / head >
< body >
< form action = "<?" PHP echo $editFormAction;? ">" method = "POST" name = "openingsuren_wijzigen" id = "openingsuren_wijzigen" >
< input name = "id []" type = "hidden" id = "id" value = "<?" PHP echo $row_rsWijzigOpeningsuren ['id'];? ">" / >
< table id = "tbl_openingsuren" >
< thead >
< b >
< scope = "col" th > Dag < /th >
< scope = "col" th > Voormiddag < /th >
< scope = "col" th > Namiddag en Avond < /th >
< /tr >
< / thead >
< tbody >
<? PHP {? >}
< b >
< td > < input name = "dag []" type = "text" id = "dag" value = "<?" PHP echo $row_rsWijzigOpeningsuren ['dag'];? ">" size = "15" maxlength = "15" / > < table >
< td > < input name = "[to] voormiddag" type = "text" id = "voormiddag" value = "<?" PHP echo $row_rsWijzigOpeningsuren ["voormiddag"];? ">" size = "15" maxlength = "15" / > < table >
< td > < input name = "[of] namiddag" type = "text" id = "namiddag" value = "<?" PHP echo $row_rsWijzigOpeningsuren ["namiddag'];? ">" size = "15" maxlength = "15" / > < table >
< /tr >
<? PHP} while ($row_rsWijzigOpeningsuren = mysql_fetch_assoc ($rsWijzigOpeningsuren));? >
< / tbody >
< /table >
< p > < input type = "submit" name = "submit" id = "submit" value = "Stayed" class = "knop" / > < / p >
< input type = "hidden" name = "MM_update" value = "openingsuren_wijzigen" / >
< / make >
< / body >
< / html >
<? PHP
mysql_free_result ($rsWijzigOpeningsuren);
? >Powerlait wrote:
I want to update multiple lines with a single click on the submit button.
Unfortunately, it does not work. What's not in the code?
It would be more useful if you were to say what is happening. "It doesn't work" is not very useful.
However, a quick look at your code is your hidden field that contains the ID outside the loop (repeat region) in your form. Place it inside the loop like this:
-
Insert/update the column with the clob data type
Hi all
ORCL Version: 11g.
I have a table with the clob data type.
Test12
(col1 clob);
I'm trying to insert/update to update the column with more than 4000 characters.
But due to the limitation of tank 4000, I could not Insert/Update.
Need your help in resolving this issue.
THX
Rod.
The limit of 4000 characters is incorrect. That pertains only to the varchar2 data type. A clob can hold more than 4 G.
Here is an example that shows how to insert it, I found...
Otherwise, here is a way 'dirty' to do.
insert into your_table (COLA, COLB)
values
(PRIMARY_KEY, PART 1 OF DATA)
;
Update your_table
Define COLB = COLB | PART 2 OF BIG DATA
where COLA = PRIMARY_KEY;
Update your_table
Define COLB = COLB | PART 3 OF BIG DATA
where COLA = PRIMARY_KEY;
.. and so on...
I don't know that I personally recommend the second style... But he could do the job.
-
update of column with the number of sequence based on the condition
HelloVersion of DB: database Oracle 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production
Here's the script to reporduce:
CREATE TABLE T2
(
PARAMLOCATION NVARCHAR2 (16).
PARAMTYPE VARCHAR2 (3 BYTE),
PARAMNUM VARCHAR2 (3 BYTE)
)Insert into T2
(PARAMLOCATION)
Values
('49');
Insert into T2
(PARAMLOCATION)
Values
(« 12 ») ;
Insert into T2
(PARAMLOCATION)
Values
(« 50 ») ;
Insert into T2
(PARAMLOCATION, PARAMTYPE)
Values
('loc51', 'B');
Insert into T2
(PARAMLOCATION, PARAMTYPE)
Values
('loc52', 'B');
Insert into T2
(PARAMLOCATION, PARAMTYPE)
Values
('loc53', 'B');
Insert into T2
(PARAMLOCATION)
Values
("loc54");
Insert into T2
(PARAMLOCATION)
Values
("loc55");
Insert into T2
(PARAMLOCATION, PARAMTYPE)
Values
('aoc01', 'I');
Insert into T2
(PARAMLOCATION, PARAMTYPE)
Values
('aoc02', 'I');
Insert into T2
(PARAMLOCATION)
Values
("loc58");
Insert into T2
(PARAMLOCATION, PARAMTYPE)
Values
("doc03", "DL");
Insert into T2
(PARAMLOCATION, PARAMTYPE)
Values
("doc02", "DL");
Insert into T2
(PARAMLOCATION, PARAMTYPE)
Values
("doc01", "DL");I should update the column in table (paramnum) function sequential paramtype as this: also you can not order in paramlocation, its like that paramlocation comes first start sequence ordering from there based on paramtype.
PARAMLOCATION PARAMTYPE PARAMNUM 49 12 50 loc51 B 1 loc52 B 2 loc53 B 3 loc54 loc55 aoc01 AI 1 aoc02 AI 2 loc58 doc03 DL 1 doc02 DL 2 doc01 DL 3 Please advice.
Hello
I'll assume you have a column called load_order, which corresponds to the order of the lines:
CREATE TABLE T2
(
NUMBER OF LOAD_ORDER
PARAMLOCATION NVARCHAR2 (16).
PARAMTYPE VARCHAR2 (3 BYTE),
PARAMNUM VARCHAR2 (3 BYTE)
) ;Insert into T2
(LOAD_ORDER, PARAMLOCATION)
Values
(1, '49');
Insert into T2
(LOAD_ORDER, PARAMLOCATION)
Values
(2, '12');
Insert into T2
(LOAD_ORDER, PARAMLOCATION)
Values
(3, '50');
Insert into T2
(LOAD_ORDER, PARAMLOCATION, PARAMTYPE)
Values
(5, 'loc51', 'B');
Insert into T2
(LOAD_ORDER, PARAMLOCATION, PARAMTYPE)
Values
(8, 'loc52', 'B');
Insert into T2
(LOAD_ORDER, PARAMLOCATION, PARAMTYPE)
Values
(13, 'loc53', 'B');
Insert into T2
(LOAD_ORDER, PARAMLOCATION)
Values
(13.2, "loc54");
Insert into T2
(LOAD_ORDER, PARAMLOCATION)
Values
(13.5, 'loc55');
Insert into T2
(LOAD_ORDER, PARAMLOCATION, PARAMTYPE)
Values
(50, 'aoc01', 'I');
Insert into T2
(LOAD_ORDER, PARAMLOCATION, PARAMTYPE)
Values
(80, 'aoc02', 'I');
Insert into T2
(LOAD_ORDER, PARAMLOCATION)
Values
(81, 'loc58');
Insert into T2
(LOAD_ORDER, PARAMLOCATION, PARAMTYPE)
Values
(82, "doc03", "DL");
Insert into T2
(LOAD_ORDER, PARAMLOCATION, PARAMTYPE)
Values
(83, "doc02", "DL");
Insert into T2
(LOAD_ORDER, PARAMLOCATION, PARAMTYPE)
Values
(99, "doc01", "DL");Any data type, this column is or what are the values it contains, as long as you can derive from the order of the rows of values in the column. (Of course, the values can be consecutive integers, only they do not have to be). If you do not have this type of column, you don't have any order to your lines, and what you request is impossible.
Since you have a load_order column, here's a way to get the results you requested:
MERGE INTO dst t2
WITH THE HELP OF)
WITH got_grp AS
(
SELECT load_order
paramlocation
paramtype
ROW_NUMBER () OVER (ORDER BY load_order)
-ROW_NUMBER () OVER (PARTITION BY CASE
WHEN paramtype IS NULL
THEN 0
END
ORDER BY load_order
) AS the grp
THE t2
)
SELECT load_order
paramlocation
ROW_NUMBER () OVER (PARTITION BY grp
ORDER BY load_order
), Paramnum
OF got_grp
WHERE the paramtype IS NOT NULL
) CBC
WE (dst.paramlocation = src.paramlocation)
WHEN MATCHED THEN UPDATE
SET dst.paramnum = src.paramnum
;
Results:
LOAD_ORDER PARAMLOCATION BY
---------- ---------------- --- ---
1 49
2 12
3 50
loc51 5 B 1
loc52 8 B 2
13 loc53 B 3
13.2 loc54
loc55 13.5
50 aoc01 AI 1
80 aoc02 AI 2
loc58 81
1 DL of 82 doc03
2 DL doc02 83
3 DL of 99 doc01
-
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
-
Update of column with the rank on the parition
Hi, I have a table A given as:
MASTER_ID, CHILD_ID
100...
100...
100...
101...
101...
102...
102...
102...
102...
The initial values of CHILD_ID are garbage and should be updated as follows:
For each unique MASTER_ID the CHILD_ID should have values beginning with 1 (with lowest rowid)
so when this column is updated the table should look like:
MASTER_ID, CHILD_ID
100, 1
100, 2
100, 3
101, 1
101, 2
102, 1
102, 2
102, 3
102, 4
Select MASTER_ID, CHILD_ID,
Rank() over (partition by MASTER_ID order by rowid) as rank
a.
give the good ranking, but when I try to update the CHILD_ID with this rank
Update)
Select MASTER_ID, CHILD_ID,
Rank() over (partition by MASTER_ID order by rowid) as rank
of (A)
Set CHILD_ID = row_id
I get the error:
SQL error: ORA-01732: non-legal data manipulation operation on this point of view
01732 00000 - 'operation not legal data manipulation on this point of view'
Can you please help me with an sql update to set this child_id?
Thank youcreate table masta ( pk_id number, ch_id number ); insert into masta values (1, 0); insert into masta values (1, 0); insert into masta values (1, 0); insert into masta values (2, 0); ME_XE?merge into masta m 2 using 3 ( 4 select 5 row_number() over(partition by pk_id order by 1) rn, 6 rowid as the_rowid 7 from masta 8 ) m1 9 on 10 ( 11 m.rowid = m1.the_rowid 12 ) 13 when matched then update set m.ch_id = m1.rn; 4 rows merged. Elapsed: 00:00:00.14 ME_XE?select * from masta; PK_ID CH_ID ------------------ ------------------ 1 1 1 2 1 3 2 1 4 rows selected. Elapsed: 00:00:00.21 ME_XE?
Ideally, you do not want to fix the application so that 'unwanted values' are not met initially in the table.
-
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 a column with 7 inputText on earpiece popupClose box
12.1.3 JDev
On the popup close listening port column on the home page is not refreshing.
In the home page, I have a column with inputText 7 and a link (all are within the same column).
When you click on the link, I'll open a popup.
Popup close listener I am affecting certain values the inputText 7.
but Popup close column is not refreshing.
I tried to link partialTrigger with the inputTxt boxes but did not work.
Also tried to make the main provision of the Panel including the inputTextbox group are surrounded, but not refreshing.
Thank you.
No difference if you call bindCreateTable.resetStampState () before programmatic refresh?
Dario
-
update multiple columns in table B of table based on the corresponding pass.
Hello
Will have two tables as below,
Here the table mu got nullability for columns RT_ID, BILL_NO. I need to update this coulmns in the mu of table with the RT_ID, BILL_NO of billing_info of table corresponding to the value of MS.create table billing_info (MS number, RT_ID number, BILL_NO number) create table mu (MS number, RT_ID number, BILL_NO number) insert into billing_info (MS,RT_ID,BILL_NO) values (1,99,635); insert into billing_info (MS,RT_ID,BILL_NO) values (2,99,635); insert into billing_info (MS,RT_ID,BILL_NO) values (3,999,1635); insert into billing_info (MS,RT_ID,BILL_NO) values (4,599,7635); insert into mu(MS) values (1); insert into mu(MS) values (2); insert into mu(MS) values (3); insert into mu(MS) values (4);
How to on this subject.
I tried the follwing examples
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:43440209618042
and
http://decipherinfosys.WordPress.com/2007/01/31/update-data-in-one-table-with-data-from-another-table/
but without hope...
It throws errors like ora-01779...UPDATE mu SET rt_id = ( SELECT rt_id FROM billing_info WHERE billing_info.ms = mu.ms ) WHERE EXISTS ( SELECT 1 FROM billing_info WHERE billing_info.ms = mu.ms )
updates all lines of MU with the RT_ID of the line in BILLING_INFO where there is a MS value assuming that such a line exists in BILLING_INFO. This assumes that MU is unique in both tables. If there are duplicates, you will need to explain how to know which line of BILLING_INFO corresponds to a particular line of MU.
Of course, from the point of view of standardization, two tables with the same key and the same nonkey column should be extremely unusual.
Justin
-
Update multiple records with one submit?
For the life of me I can't figure out how to do this. I have boxes with the ID primary key listed as the value of a repeat region. I want to perform an update on 2 columns for all checked IDs.
CODE SUDEO
< form >
< cfoutput query...
other textfields...
< input name = "checkbox" type = "checkbox" id = "checkbox" value = "" #table.id # "/ >"
< / cfoutput >
SUBMIT BUTTON
< / make >
My update statement:
UPDATE table
SET 1 = Column1, column2 = 'whatever '.
WHERE id IN (< cfqueryparam cfsqltype = "cf_sql_integer" value = "#TRIM (FORM.checkbox) #" >)
< / cfquery >It updates only if I check a box has no effect when more than one is selected.
I also tried a loop during the update statement, but nothing seems to work.
You must use the cfqueryparam list attribute.
-
Update a column with Oracle...
Dear experts!
Oracle is driving me crazy... I just want to use an update like this statement:
UPDATE FPS
DEFINE FPS. DK_ORGA_BEREICH = "MZ."
FPS, FPG
WHERE FPS. FK_FPG_NR = GIF. PK_FPG_NR
AND FPS. DK_ORGA_BEREICH = "AL".
AND THE FOREST PRODUCTS GROUP. DK_ORGA_BEREICH = "MZ."
saying "in the table of FPS, please change DK_ORGA_BEREICH in 'MZ' where it is 'AL' now and where something else of the FPG table is already"MZ"now...» »
but Oracle does not understand/like what I want to do. I used google to search for, but all I found was illogical to me to 200%, I simply didn't understand the Oracle syntax to be used in cases like this, considering that 'my' syntax seems simple to me. Could someone please help me fix my SQL and explaining to me the corrected version, so this stupid understand me, too?
Thank you very much!
With sincere friendships.
Chriss, who thought he could at least do something simple like this in almost no time... Oops!
Edited by: user9355711 the 04.05.2010 07:25It looks like you want a correlated update statement. Maybe something like that?
UPDATE FPS F SET F.DK_ORGA_BEREICH = 'MZ' WHERE F.DK_ORGA_BEREICH = 'AL' AND EXISTS ( SELECT NULL FROM FPG FG WHERE FG.PK_FPG_NR = F.FK_FPG_NR AND FG.DK_ORGA_BEREICH = 'MZ' )
The EXISTS clause verify existence of lines. It is CORRELATED because the subquery (SELECT statement) is related to the outer query (UPDATE statement) via the FG PK_FPG_NR = F.FK_FPG_NR condition.
So this query updates of the lines in the FPS if the DK_ORGA_BEREICH = 'AL' and there is a GJ for all ranks in FPS (based on the already mentioned join condition) with a DK_ORGA_BEREICH of "MZ."
Edited by: Centinul may 4, 2010 10:27
-
update of column with another column with in the same table
Hello
We are using oracle 10g,
I have a table with two columns i a s number one other data type is varchar2, varchar2 column contains
numAriques and data type character I want to move only numAriques to the numeric data type field data, please kindly give answer
Thanks and greetings
tmadugulaYou are not providing any version of the database, sample data or table desc, but anyway:
http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:3083286970877 #49518312679214
Something like:
create or replace function is_num (p_str in varchar2) return number as begin return to_number(p_str); exception when others then return null; end;
Which translates into:
MHO%xe> select * from bla; MY_VA MY_NUMBER ----- ---------- AAAAA BBBBB 11111 22222 CCCCC 33333 6 rijen zijn geselecteerd. Verstreken: 00:00:01.32 MHO%xe> desc bla Naam Null? Type ----------------------------------------- -------- ---------------------------- MY_VARCHAR VARCHAR2(5) MY_NUMBER NUMBER(5) MHO%xe> select * from bla where is_num(my_varchar) is not null; MY_VA MY_NUMBER ----- ---------- 11111 22222 33333 Verstreken: 00:00:01.73 MHO%xe> update bla 2 set my_number = is_num(my_varchar) 3 where is_num(my_varchar) is not null; 3 rijen zijn bijgewerkt. Verstreken: 00:00:00.51 MHO%xe> select * from bla; MY_VA MY_NUMBER ----- ---------- AAAAA BBBBB 11111 11111 22222 22222 CCCCC 33333 33333 6 rijen zijn geselecteerd.
Maybe you are looking for
-
My D4 is actually charged?
My wife's phone has been recently replaced 3 months ago with a Droid 4 refurbished. Recently, any time load us sound phone for a good period of time, he won't go higher than 70%. When we unplug the phone charger [which is the original btw charger], i
-
Looking for info on HP ENVY Phoenix h9 SATA - 1400 t
My search is narrowed down. I need to know one thing. It is SATA II or SATA III for HP ENVY Phoenix h9 - 1400t. It is customized with 8 64 windows.
-
distributed antenna system usrp 2920
Hi all I implemented an OFDM transceiver using two usrps one transmitter and one receiver, I also did all the normal tasks of synchronization (detection of frame timing recovery, CFO correction and channel estimation) needed to compute the BER to the
-
SCXI-1600 is not communicating with MAX
All- Maybe that someone else has come across this. I have connected an SCXI-1600 module in an SCXI-1000 chassis to a computer with a USB cable. I can not get NOR-MAX to recognize the device. I ' v tried to restart and reconnect in different orders
-
Pavilion 17 e020us: no internet connection after upgrading to Windows 10
Hello guys,. I have a problem with the internet connection. My computer started to upgrate by itself for 10 windows while I did other work at my home. I was waiting until he finished. When it's done I realized that I have no internet, not only my wir