Syntax of UPDATE of Oracle with the JOIN and the WHERE clause
I need to update one of my paintings and can't seem to get the syntax right. I tried 4 different approaches, but does not have a chance. Any help would be greatly appreciated.
Attempt #1: Error: not correctly completed SQL command
UPDATE TESTDTA.F4941
SET TESTDTA.F4941.RSDSTN=TESTDTA.F4981.FHRTDQ,TESTDTA.F4941.RSUMD1=TESTDTA.F4981.FHUOM
FROM TESTDTA.F4941
INNER JOIN TESTDTA.F4981
ON TESTDTA.F4941.RSSHPN = TESTDTA.F4981.FHSHPN
WHERE TESTDTA.F4941.RSSHPN = 647143
AND TESTDTA.F4941.RSDSTN = 0
AND TESTDTA.F4941.RSADDJ > 110365
AND TESTDTA.F4981.FHCGC1 = 'DIS';
Try #2: Error report: SQL error: ORA-00904: "TESTDTA." "" F4981 ". "' FHUOM ': invalid identifier 00904. 00000 - '% s: invalid identifier '.
UPDATE (SELECT TESTDTA.F4941
FROM TESTDTA.F4941
INNER JOIN TESTDTA.F4981
ON TESTDTA.F4941.RSSHPN = TESTDTA.F4981.FHSHPN
WHERE TESTDTA.F4941.RSSHPN = 647143
AND TESTDTA.F4941.RSDSTN = 0
AND TESTDTA.F4941.RSADDJ > 110365
AND TESTDTA.F4981.FHCGC1 = 'DIS')
SET TESTDTA.F4941.RSDSTN=TESTDTA.F4981.FHRTDQ,TESTDTA.F4941.RSUMD1=TESTDTA.F4981.FHUOM
Try #3: Error report: SQL error: ORA-00904: "TESTDTA." "' F4941 ': invalid identifier 00904. 00000 - '% s: invalid identifier '.
UPDATE (SELECT *
FROM TESTDTA.F4941
INNER JOIN TESTDTA.F4981
ON TESTDTA.F4941.RSSHPN = TESTDTA.F4981.FHSHPN
WHERE TESTDTA.F4941.RSSHPN = 647143
AND TESTDTA.F4941.RSDSTN = 0
AND TESTDTA.F4941.RSADDJ > 110365
AND TESTDTA.F4981.FHCGC1 = 'DIS')
SET TESTDTA.F4941.RSDSTN=TESTDTA.F4981.FHRTDQ,TESTDTA.F4941.RSUMD1=TESTDTA.F4981.FHUOM;
Try #4: Error: ORA-00925: Missing keyword 00925. 00000 - "missing IN the keyword"
MERGE TESTDTA.F4941
USING TESTDTA.F4981
ON (TESTDTA.F4941.RSSHPN = TESTDTA.F4981.FHSHPN
AND TESTDTA.F4941.RSSHPN = 647143
AND TESTDTA.F4941.RSDSTN = 0
AND TESTDTA.F4941.RSADDJ > 110365
AND TESTDTA.F4981.FHCGC1 = 'DIS'
)
WHEN MATCHED THEN
UPDATE SET TESTDTA.F4941.RSDSTN=TESTDTA.F4981.FHRTDQ
,TESTDTA.F4941.RSUMD1=TESTDTA.F4981.FHUOM;
Finally managed to do work, adding DISTINCT to select. I have pasted the SQL error in Google to begin with. Laughing out loud!
Code snippet work for anyone who comes across this thread...
MERGE INTO TESTDTA. F4941 DST
USING (SELECT DISTINCT TESTDTA. F4941. RSSHPN,
TESTDTA. F4941. RSDSTN,
TESTDTA. F4941. RSUMD1,
TESTDTA. F4941. RSADDJ,
TESTDTA. F4981. FHSHPN,
TESTDTA. F4981. FHRTDQ,
TESTDTA. F4981. FHUOM,
TESTDTA. F4981. FHCGC1
OF TESTDTA. F4941
JOIN INTERNAL TESTDTA. F4981
ON TESTDTA. F4941. RSSHPN = TESTDTA. F4981. FHSHPN
WHERE - TESTDTA. F4941. RSSHPN = 647143 AND
TESTDTA. F4941. RSDSTN = 0
AND TESTDTA. F4941. RSADDJ > 110365
AND TESTDTA. F4981. FHCGC1 = 'SAY') CBC
on (DST. RSSHPN = SRC. FHSHPN)
When matched then update
SET DST. RSDSTN = SRC. FHRTDQ, SUMMER TIME. RSUMD1 = SRC. FHUOM;
Thanks to everyone who helped with this.
Tags: Database
Similar Questions
-
T/t with the WHERE clause using a list breaks
Hello, all,.
I have a project where I need to use a list as part of the WHERE clause for a t/t, and it is breaking. I don't know what I'm doing wrong.
For some pseudo-code, do I have a complete query of a database called 'people '. A list of values for the t/t with the first query; the second query is my t/t:
<cfquery name="getDIR" datasource="#request.THISDSN#"> SELECT thisName dir FROM orgs WHERE thisID in (<cfqueryparam value="#form.org#" cfsqltype="cf_sql_varchar" list="yes" />) </cfquery> <cfquery name="people" database="people"> SELECT colA, colB, colC, colD FROM people WHERE 1=1 AND ( div IN (<cfqueryparam value="#valueList(getDIR.dir)#" cfsqltype="varchar" list="yes" />) OR dir IN (<cfqueryparam value="#valueList(getDIR.dir)#" cfsqltype="varchar" list="yes" />) ) </cfquery>
I get the error message is "t/t syntax error: encountered" div IN \'thisValue\' ".» Incorrect conditional expression, waiting for one of [as | null | between | in | comparison] condition. »
Can support _not_ QoQ lists of WHERE clauses?
V/r,
^_^
SMH - so much... I just found.
I forgot to give the lists in the second query bracket.
(The pseudocode was manually typed, since my dev system is isolated from the internet, and I added the in my pseudo code when they were not in my original code.)
* headdesk * headdesk * headdesk * headdesk *.
V/r,
^_^
-
Difference-conditions (join and a Where Clause)
Hi people,
I need to clearly agree on what a difference exactly when we put any condition in INNER JOIN and the WHERE Clause.
I have tried both way and found the same results. Even in the statistics Plan not much differences. Any help would be appreciated.
As:
1 here, I use filter store in the join condition - Inner
"SELECT i., Gl * Sc1.Item I.
Inner Join Sc1.Part P
On P.Part_Id = I.Part_Id
Inner Join Sc1.Location Gl
On Gl.Location_Id = I.Location_Id
And Gl.Location_Id in (1767, 1747,202,1625)
Inner Join Sc1.Condition C
On C.Condtion_Id = Gl.Condition_Id
Where I.Inactive_Ind = 0
And I.Condition_Id! = 325
2. here I use filter store in Where clause-
SELECT i., Gl * Sc1.Item I
Inner Join Sc1.Part P
On P.Part_Id = I.Part_Id
Inner Join Sc1.Location Gl
On Gl.Location_Id = I.Location_Id
Inner Join Sc1.Condition C
On C.Condtion_Id = Gl.Condition_Id
Where I.Inactive_Ind = 0
and I.LOCATION_ID in (1767, 1747,202,1625)
And I.Condition_Id! = 325
Thank you
Mark
Hello
MarkCooper wrote:
Hi guys,.
To reply to all - I understand.
1. its good practice to use conditions / filter (except CLAUSE) in the WHERE Clause rather Inner join? bon ?
2. now, in my previous example. We could use the location code in where clause as it was in the two tables.
What is the best practice to use the code to location here ( 1 /2) ?
1. here I use filter store in the Inner join condition ( guess the location code is not in the article table)).
"SELECT i., Gl * Sc1.Item I.
Inner Join Sc1.Part P
On P.Part_Id = I.Part_Id
Inner Join Sc1.Location Gl
On Gl.Location_Id = I.Location_Id
And Gl.Location_Id in (1767, 1747,202,1625)
Inner Join Sc1.Condition C
On C.Condtion_Id = Gl.Condition_Id
Where I.Inactive_Ind = 0
And I.Condition_Id! = 325
2. here I use filter store in Where clause (assume that the location code is not in the article table)-
SELECT i., Gl * Sc1.Item I
Inner Join Sc1.Part P
On P.Part_Id = I.Part_Id
Inner Join Sc1.Location Gl
On Gl.Location_Id = I.Location_Id
Inner Join Sc1.Condition C
On C.Condtion_Id = Gl.Condition_Id
Where I.Inactive_Ind = 0
And Gl.Location_Id in (1767, 1747,202,1625)
And I.Condition_Id! = 325
Thank you
If location_id isn't in the item table, then the join condition
On Gl.Location_Id = I.Location_Id
will cause an error.
Once more, it should not affect results or performance if a condition like
Gl.Location_Id in (1767, 1747,202,1625)
is in the clause or the WHERE clause. No matter if it is be a column called location_id in any other table, or if the same column Gl.Location_Id is used in other conditions.
As this condition only refers to a table (GI), I recommend you put it in a WHERE clause, just to make the code clearer.
Yet once, this applies only to the inner joins, not for outer joins and not to CONNECT BY queries.
-
I have a Select statement where I want to select rows where weighs only 1 of the selected date 3 columns is null. Is this possible?
Select rec_date, prior_rec_date2, prev_rec_date3
of my_receipts
where (not more than 1 or the date 3 fields is null)
Any help would be greatly appreciated.Hello
WHERE NVL2 (rec_date, 1, 0) + NVL2 (prior_rec_date2, 1, 0) + NVL2 (prev_rec_date3, 1, 0) >= 2
-
outer join on query with the GOLD clause
Hi all, I have a problem outerjoining a clause or a request with
Here's my data
as you can see I am attaching the table 1 and table 2. I join with txt1, if txt1 is null, then join by txt2, if null, then reach by txt3 and so on.WITH table1 AS ( SELECT 'test' txt1, 'pak' txt2, 'ced' txt3, 'su' txt4 FROM dual UNION ALL SELECT null txt1, 'pak' txt2, 'ced2' txt3, 'su2' txt4 FROM dual UNION ALL SELECT null txt1, NULL txt2, 'ced3' txt3, 'su3' txt4 FROM dual UNION ALL SELECT null txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL SELECT 'text5' txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL SELECT null txt1, NULL txt2, null txt3, null txt4 FROM dual ) ,table2 AS ( SELECT 111 pid, 'test' txt1, 'pak4' txt2, 'ced' txt3, 'su' txt4 FROM dual UNION ALL SELECT 222 pid, 'test1' txt1, 'pak' txt2, 'ced2' txt3, 'su2' txt4 FROM dual UNION ALL SELECT 333 pid, 'test2' txt1, 'pak3' txt2, 'ced3' txt3, 'su4' txt4 FROM dual UNION ALL SELECT 444 pid, 'test2' txt1, 'pak3' txt2, 'ced4' txt3, 'su3' txt4 FROM dual ) SELECT b.pid, a.* from table1 a, table2 b WHERE (a.txt1 = b.txt1 OR a.txt1 IS NULL AND a.txt2=b.txt2 OR Nvl(a.txt2, a.txt1) IS NULL AND a.txt3 = b.txt3 OR Nvl(a.txt2, a.txt1) IS NULL AND a.txt3 IS NULL AND a.txt4 = b.txt4 )
the above produces this output code
This output is partially correct. only 4 lines were in display and two has been left outPID TXT1 TXT2 TXT3 TXT4 === ==== === ==== ==== 111 test pak ced su 222 pak ced2 su2 333 ced3 su3 444 su3
I tried to use the outer join, but oracle will complain that I can't use outerjoin with the GOLD clause.SELECT 'text5' txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL SELECT null txt1, NULL txt2, null txt3, null txt4 FROM dual
can someone modify my query to display the output below?
PID TXT1 TXT2 TXT3 TXT4 === ==== === ==== ==== 111 test pak ced su 222 pak ced2 su2 333 ced3 su3 444 su3 NULL NULL NULL NULL NULL test5
Not sure you can do it with the style of the Oracle of outer joins, but open ANSI style joins is simple, in fact exactly as you had it.
SQL> set null null; SQL> WITH table1 AS ( 2 SELECT 'test' txt1, 'pak' txt2, 'ced' txt3, 'su' txt4 FROM dual UNION ALL 3 SELECT null txt1, 'pak' txt2, 'ced2' txt3, 'su2' txt4 FROM dual UNION ALL 4 SELECT null txt1, NULL txt2, 'ced3' txt3, 'su3' txt4 FROM dual UNION ALL 5 SELECT null txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL 6 SELECT 'text5' txt1, NULL txt2, null txt3, 'su3' txt4 FROM dual UNION ALL 7 SELECT null txt1, NULL txt2, null txt3, null txt4 FROM dual), 8 table2 AS ( 9 SELECT 111 pid, 'test' txt1, 'pak4' txt2, 'ced' txt3, 'su' txt4 FROM dual UNION ALL 10 SELECT 222 pid, 'test1' txt1, 'pak' txt2, 'ced2' txt3, 'su2' txt4 FROM dual UNION ALL 11 SELECT 333 pid, 'test2' txt1, 'pak3' txt2, 'ced3' txt3, 'su4' txt4 FROM dual UNION ALL 12 SELECT 444 pid, 'test2' txt1, 'pak3' txt2, 'ced4' txt3, 'su3' txt4 FROM dual) 13 SELECT b.pid, a.* 14 from table1 a 15 LEFT JOIN table2 b 16 ON (a.txt1 = b.txt1 OR 17 a.txt1 IS NULL AND a.txt2=b.txt2 OR 18 Nvl(a.txt2, a.txt1) IS NULL AND a.txt3 = b.txt3 OR 19 Nvl(a.txt2, a.txt1) IS NULL AND a.txt3 IS NULL AND a.txt4 = b.txt4); PID TXT1 TXT2 TXT3 TXT4 ---------- ------ ------ ------ ------ 111 test pak ced su 222 null pak ced2 su2 333 null null ced3 su3 444 null null null su3 null text5 null null su3 null null null null null
John
-
Updated my iPad with the new OS.
Updated my iPad with the new OS. Initially it lights, so I have two buttons held together and finally happened. Now it is stuck on the screen with the time and will not move forward, nor is it resets. Is there any solution for this?
Thank you
Kat
Try a forced reboot. Hold down the home and Sleep/Wake buttons simultaneously for about 15-20 seconds , until the Apple logo appears. You won't lose anything.
If a force restart does not help try recovery Mode:
-
I've updated for picture with the captain and when I plug in my iPhone it loads the same pictures twice each time how it stop loading the same things every day? I tried to make the old default iphoto but picture still open when I plug in my iPhone?
I tried to make the old default iphoto but picture still open when I plug in my iPhone?
When the iPhone is connected and Photos opens, select iPhone in sideba of the windowr of Photos. Then, uncheck the option 'Open for this iPhone Photos' below the toolbar. Do this for all your iPhones. The hook should be unmarked for each device individually.
-
I have laptop HP Pavilion dv7-1260. When I put in a blu - ray disc I'm propmted to get an update. Even with the update, it will not play a blu ray.
Hello
· What is the update message that you receive?
· Do you have an error message when you try to read the Blu - ray Disc?
· This problem occurs only with Blu ray discs or any of the others?
To play a Blu - ray disc, you must use a non-Microsoft program that supports Blu - ray playback and a device that can play Blu - ray discs.
See the link below:
http://Windows.Microsoft.com/en-us/Windows7/MPEG-and-DVD-video-frequently-asked-questions
-
Can Hello anyone help?
After you configure Subversion in Dreamweaver, I get this error again!
SVN: 155021 #. You cannot update this file with the help of Dreamweaver Subversion integration because a new Subversion client application on your machine has made updates to the file Subversion meta data. For more information about this issue, see http://www.adobe.com/go/dw_svn_en.
even after following the instructions http://www.Adobe.com/go/dw_svn_en Download the extension, python change the var in windows to say «;» C:\Python26'
with & without quotes, with or without; before C
command > comparability of Subversion to get the following error "the Conversion process has failed. Please make sure you have Python installed and you check Python PATH parameter'
I managed to get all the files after the installation, I locked, unlocked and commit a file to test fact so that was all works well, the only part I'm not retrieves the latest version, this is because Subversion is 1.6.2 and dreamweaver must revert to the version 1.4.5 on local to work, the compile someone at - it an idea what to try next in order to make it work?
Just a reminder!
- I configure Subversion through guidelines on http://help.Adobe.com/en_US/Dreamweaver/10.0_Using/WS80FE60AC-15F8-45a2-842E-52D29F540FED. html
- I managed to get the latest SVN version
- Lock, unlock and commit a file
- Installed Python in C:\Python26 change the path in windows system properties > advanced > Environment Variables > system variables > New > Python =; C:\Python26 also C:\Python26
- I also tried the same thing in the User Variables
- Installed the extension DW Subversion compatibility
Tried to run the compatibly with the command > Subversion comparability in DW
Welcome any suggestion to solve this?
Hello
There has been a lot of problems using svn with dw, and I know many people who have stopped trying to operate correctly.
As much as I know dw will not work with newer versions of svn (over 1.5), and even then, there are a lot of problems, a possible solution is to try subweaver (at- http://code.google.com/p/subweaver/ ), as this has solved some of the problems associated with the use of tsvn dw environment.
PZ
-
BAD RESULTS WITH OUTER JOINS AND TABLES WITH A CHECK CONSTRAINT
HII All,
Could any such a me when we encounter this bug? Please help me with a simple example so that I can search for them in my PB.
Bug:-8447623
Bug / / Desc: BAD RESULTS WITH OUTER JOINS AND TABLES WITH a CHECK CONSTRAINT
I ran the outer joins with check queries constraint 11G 11.1.0.7.0 and 10 g 2, but the result is the same. Need to know the scenario where I will face this bug of your experts and people who have already experienced this bug.
Version: -.
SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production PL/SQL Release 11.1.0.7.0 - Production CORE 11.1.0.7.0 Production TNS for Solaris: Version 11.1.0.7.0 - Production NLSRTL Version 11.1.0.7.0 - Production
Why do you not use the description of the bug test case in Metalink (we obviously can't post it here because it would violate the copyright of Metalink)? Your test case is not a candidate for the elimination of the join, so he did not have the bug.
Have you really read the description of the bug in Metalink rather than just looking at the title of the bug? The bug itself is quite clear that a query plan that involves the elimination of the join is a necessary condition. The title of bug nothing will never tell the whole story.
If you try to work through a few tens of thousands of bugs in 11.1.0.7, of which many are not published, trying to determine whether your application would be affected by the bug? Wouldn't be order of magnitude easier to upgrade the application to 11.1.0.7 in a test environment and test the application to see what, if anything, breaks? Understand that the vast majority of the problems that people experience during an upgrade are not the result of bugs - they are the result of changes in behaviour documented as changes in query plans. And among those who encounter bugs, a relatively large fraction of the new variety. Even if you have completed the Herculean task of verifying each bug on your code base, which would not significantly easier upgrade. In addition, at the time wherever you actually performed this analysis, Oracle reportedly released 3 or 4 new versions.
And at this stage would be unwise to consider an upgrade to 11.2?
Justin
-
Outer joins and null in the 'where' clause condition
Hi people,
Please help me on this.
Here's my query.
with x
(select 'a' as a dual union all col1)
Select 'b' as col1 of union double all the
Select 'c' as double col1
),
y as
(
Select 'b' as col2 from dual Union all the
Select 'c' as col2 from dual Union all the
Select would be "as col2 from dual Union all the"
Select 'e' as col2 from dual
)
Select * x y right outer join
on x.col1 = y.col2 and y.col2 is null
Get all the lines of 'COL1' as null. Why like this?
Just add the condition to the WHERE clause for example
WITH x AS (SELECT 'a' AS col1 FROM dual UNION ALL SELECT 'b' AS col1 FROM dual UNION ALL SELECT 'c' AS col1 FROM dual ), y AS ( SELECT 'b' AS col2 FROM dual UNION ALL SELECT 'c' AS col2 FROM dual UNION ALL SELECT 'd' AS col2 FROM dual UNION ALL SELECT 'e' AS col2 FROM dual ) SELECT * FROM x LEFT OUTER JOIN y ON x.col1=y.col2 ----want to add "and y.col2 is null " condition to get value "a" where y.col2 is null
-
Beginner: Get on the WHERE clause syntax error in SELECT
I am very new to php and mySQL. Use DW master/detail to generate Basic code I need. One thing I have to do is to modify a select statement in the master to include a WHERE clause to limit the selection to a particular value in a field.
I get a syntax error with the select statement in the WHERE clause, I add to the map.
It's the part of the error message showing the location of the error:
"WHERE group = 'Community' LIMIT 0, 10'"
Php that generated the select is:
$query_maps = "SELECT * FROM tblmaps ORDER BY tblmaps.» DispSeq ';
$query_limit_maps = sprintf ("%s WHERE group =' LIMIT %s %d, %d", $query_maps, $selectGroup, $startRow_maps, $maxRows_maps);
This approach to create the select statement is on the generated code for the master page. He added the LIMIT clause. I didn't add the ' WHERE group = '%s' and the variable $selectGroup, which comes from the old code.» You can see that the $selectGroup variable is equal to the "community: group.»
I scanned the web to see what syntax error, I could do, but haven't found anything that explains it.
The resolved full select statement is:
SELECT * FROM tblmaps ORDER BY tblmaps. WHERE DispSeq = 'Community' LIMIT 0,10 group
What I don't see?
Tom
The group is a reserved word in MySQL. You could probably put single quotes around it, but I suggest to rename this column. Do not use reserved words for column names.
-
Execution of statement of UPDATE for the whole table even when the WHERE Clause is presentation
Hi friends,
I have a problem in a stored procedure where I wrote an update with a where clause clause statement. At some point only one line should be updated according to the unique identifier in where clause.
But what is happening is that the Update statement is getting executed for all rows in the table to neglect the WHERE clause. I don't get any idea of why this is happening. Here is the stored procedure and the update statement is BOLD:-
CREATE OR REPLACE PROCEDURE MDMADM.proc_MDM_InsertCntryDetails
(
CntryMasterCode IN VARCHAR2,
CntryName IN VARCHAR2,
MDMUser IN VARCHAR2,
Exists IN ITS ENTIRETY,
status in VARCHAR2,
Inserted_By IN VARCHAR2 default NULL,
Modified_By IN VARCHAR2 default NULL,
Mdm_Code IN the DEFAULT NUMBER 0.
Action in VARCHAR2 DEFAULT 'Add ',.
XGenAttNames IN VARCHAR2 default NULL,
XGenAttValues IN VARCHAR2 default NULL,
MirusAttNames IN VARCHAR2 default NULL,
MirusAttValues IN VARCHAR2 default NULL,
GenisysAttNames IN VARCHAR2 default NULL,
GenisysAttValues IN VARCHAR2 default NULL,
XGenModify IN VARCHAR2 default NULL,
MirusModify IN VARCHAR2 default NULL,
GenisysModify IN VARCHAR2 default NULL
)
IS
strSQLXGen VARCHAR (1000);
strSQLMirus VARCHAR (1000);
strSQLGenisys VARCHAR (1000);
nMaxMDMCode INTEGER.
ifExist INTEGER;
/******************************************************************************
NAME: proc_MDM_InsertCntryDetails
PURPOSE:
REVISIONS:
Worm Date Description of the author
--------- ---------- --------------- ------------------------------------
1.0 03/07/2009 1. Created this procedure.
NOTES:
Keywords to replace automatically available Auto:
Object name: proc_MDM_InsertCntryDetails
SYSDATE: 03/07/2009
Date and time: 03/07/2009, 19:11:20 and 03/07/2009-19:11:20
User name: (put in TOAD Options, editor of the procedure)
Name of the table: (defined in the dialog box "New PL/SQL object")
******************************************************************************/
BEGIN
COUNT (*) of SELECT INTO ifExist OF MDM_COUNTRY_MASTER;
IfExist IF = 0 THEN
SELECT 1 INTO nMaxMDMCode FROM DUAL;
ON THE OTHER
SELECT MAX (MDM_CODE) + 1 IN MDM_COUNTRY_MASTER nMaxMDMCode;
END IF;
IF Action = "add" THEN
INSERT INTO MDM_COUNTRY_MASTER(MDM_CODE,MDM_MASTER_CODE,MDM_DESCRIPTION,MDM_USER,MDM_EXIST,MDM_STATUS,MDM_ACTION,DAT_INSERT_DATE,DAT_INSERTED_BY)
VALUES(nMaxMDMCode,CntryMasterCode,CntryName,MDMUser,exist,Status,action,sysdate,Inserted_By);
strSQLXGen: = ' INSERT IN MDM_COUNTRY_MAPPING (MDM_CODE, SYSTEM_NAME, SYSTEM_CODE,' |) XGenAttNames | DAT_INSERTED_BY, DAT_INSERT_DATE) ' |
"VALUES (' |)" nMaxMDMCode | ',' || '''' || "XGen | '''' || ',1,' || XGenAttValues | ',' || '''' || Inserted_By | '''' || SYSDATE)';
EXECUTE IMMEDIATE strSQLXGen;
strSQLMirus: = ' INSERT IN MDM_COUNTRY_MAPPING (MDM_CODE, SYSTEM_NAME, SYSTEM_CODE,' |) MirusAttNames | DAT_INSERTED_BY, DAT_INSERT_DATE) ' |
"VALUES (' |)" nMaxMDMCode | ',' || '''' || "Mirus | '''' || ',2,' || MirusAttValues | ',' || '''' || Inserted_By | '''' || SYSDATE)';
EXECUTE IMMEDIATE strSQLMirus;
strSQLGenisys: = ' INSERT IN MDM_COUNTRY_MAPPING (MDM_CODE, SYSTEM_NAME, SYSTEM_CODE,' |) GenisysAttNames | DAT_INSERTED_BY, DAT_INSERT_DATE) ' |
"VALUES (' |)" nMaxMDMCode | ',' || '''' || "Genisys | '''' || ',3,' || GenisysAttValues | ',' || '''' || Inserted_By | '''' || SYSDATE)';
EXECUTE IMMEDIATE strSQLGenisys;
ON THE OTHER
UPDATE MDM_COUNTRY_MASTER
SET MDM_DESCRIPTION = CntryName, DAT_MODIFIED_BY = Modified_By, DAT_MODIFY_DATE = SYSDATE.
MDM_USER = MDMUser, MDM_ACTION = Action, MDM_STATUS = status MDM_EXIST = exist WHERE MDM_CODE = Mdm_Code;
COUNT (*) of SELECT INTO ifExist FROM MDM_COUNTRY_MAPPING WHERE SYSTEM_CODE = 1 AND MDM_CODE = Mdm_Code;
IfExist IF = 0 THEN
strSQLXGen: = ' INSERT IN MDM_COUNTRY_MAPPING (MDM_CODE, SYSTEM_NAME, SYSTEM_CODE,' |) XGenAttNames | DAT_INSERTED_BY, DAT_INSERT_DATE) ' |
' VALUES(' ||) Mdm_Code | ',' || '''' || "XGen | '''' || ',1,' || XGenAttValues | ',' || '''' || Modified_By | '''' || SYSDATE)';
EXECUTE IMMEDIATE strSQLXGen;
ON THE OTHER
strSQLXGen: = "UPDATE MDM_COUNTRY_MAPPING SET | XGenModify | ', DAT_MODIFY_DATE = SYSDATE, DAT_MODIFIED_BY =' | '''' || Modified_By | '''' || "WHERE MDM_CODE =' | ' Mdm_Code | "and SYSTEM_CODE = 1';
EXECUTE IMMEDIATE strSQLXGen;
END IF;
COUNT (*) of SELECT INTO ifExist FROM MDM_COUNTRY_MAPPING WHERE SYSTEM_CODE = 2 AND MDM_CODE = Mdm_Code;
IfExist IF = 0 THEN
strSQLMirus: = ' INSERT IN MDM_COUNTRY_MAPPING (MDM_CODE, SYSTEM_NAME, SYSTEM_CODE,' |) MirusAttNames | DAT_INSERTED_BY, DAT_INSERT_DATE) ' |
' VALUES(' ||) Mdm_Code | ',' || '''' || "Mirus | '''' || ',2,' || MirusAttValues | ',' || '''' || Modified_By | '''' || SYSDATE)';
EXECUTE IMMEDIATE strSQLMirus;
ON THE OTHER
strSQLMirus: = "UPDATE MDM_COUNTRY_MAPPING SET | MirusModify | ', DAT_MODIFY_DATE = SYSDATE, DAT_MODIFIED_BY =' | '''' || Modified_By | '''' || "WHERE MDM_CODE =' | ' Mdm_Code | "and SYSTEM_CODE = 2';
EXECUTE IMMEDIATE strSQLMirus;
END IF;
COUNT (*) of SELECT INTO ifExist FROM MDM_COUNTRY_MAPPING WHERE SYSTEM_CODE = 3 AND MDM_CODE = Mdm_Code;
IfExist IF = 0 THEN
strSQLGenisys: = ' INSERT IN MDM_COUNTRY_MAPPING (MDM_CODE, SYSTEM_NAME, SYSTEM_CODE,' |) GenisysAttNames | DAT_INSERTED_BY, DAT_INSERT_DATE) ' |
' VALUES(' ||) Mdm_Code | ',' || '''' || "Genisys | '''' || ',3,' || GenisysAttValues | ',' || '''' || Modified_By | '''' || SYSDATE)';
EXECUTE IMMEDIATE strSQLGenisys;
ON THE OTHER
strSQLGenisys: = "UPDATE MDM_COUNTRY_MAPPING SET | GenisysModify | ', DAT_MODIFY_DATE = SYSDATE, DAT_MODIFIED_BY =' | '''' || Modified_By | '''' || "WHERE MDM_CODE =' | ' Mdm_Code | "and SYSTEM_CODE = 3';
EXECUTE IMMEDIATE strSQLGenisys;
END IF;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
WHILE OTHERS THEN
-Consider recording the error and then re-raise
LIFT;
END proc_MDM_InsertCntryDetails;
/
Thank you>
WHERE mdm_code = mdm_code
>This will always be value true - similar to WHERE 1 = 1.
You typed it wrong or is the same as the variable column name? If they are the same test rename one of them.
-
Try adding conditions to clause "and" stored in the table for the where clause, unknown syntax
I am trying to add additional segments to the 'where' clause, and I don't know exactly how to proceed. I am currently using another table to search for keywords and sometimes there aren't everything. I use this table containing the key words to search the description and associate a symbol with a path.
The code loops through the keywords with the keywords most associated and try to find links to a symbol then excludes those and search for symbols that correspond to those with less keywords and all. I am able to do this with 6 queries and manually changing the arguments, but I want to loop together so that if the changes need to be made in the future, I won't need to go digging in the code.
Thanks, but that's ok. I already have a solution for this.
-
Cannot run a «BUSINESS...» WHEN ' with a date in a WHERE CLAUSE condition
Hello
I need to check for a condition and date according to the date, he would check a set of host names or the other game... so I thought I could write something like this in the WHERE clause:
AND HOST_NAME IN (
CASE
WHEN TO_DATE (: StopDate, 'MON-DD-YYYY') > = TO_DATE ('22 - DEC - 2015 "," DD-MON-YYYY ') THEN
('SERVERNAMEA', 'SERVERNAMEB', 'SERVERNAMEC') ON THE OTHER
("SERVERNAME1", "NAMESERVER2", "SERVERNAME3")
END
)
I get the following:
ORA-00907: lack of right parenthesis
00907 00000 - "lack the right parenthesis.
But there is no missing parentheses!
If I take the case... when... end, and run the host_name in ('SERVERNAMEA', 'SERVERNAMEB', 'SERVERNAMEC') (separately, they run fine)...
I also tried:
AND
( CASE
WHEN TO_DATE (: StopDate, 'MON-DD-YYYY') > = TO_DATE ('22 - DEC - 2015 "," DD-MON-YYYY ') THEN
HOST_NAME IN ('SERVERNAMEA', 'SERVERNAMEB', 'SERVERNAMEC') ELSE
HOST_NAME IN ('SERVERNAME1","NAMESERVER2","SERVERNAME3")
END
)
the error I get is:
ORA-00905: lack of keyword
00905 00000 - 'lack the key word'
What keyword miss me?
Post edited by: c75d2e42-06a0-4eb1-a576-5652edcbfbe8
Hello
c75d2e42-06a0-4eb1-A576-5652edcbfbe8 wrote:
It was a typo when transferred to the Oracle forum... the version of Oracle is: PL/SQL version 10.2.0.3.0 (10 G)
I also used IF the statement and that has not worked (in error "missing parenthesis") which I'm sure is a matter of "syntax"... I did not know that the CASE statement returns the value single only, so it's probably the problem. Is it possible to re - write this?
...
IF only works in PL/SQL. It does not in SQL, even if that SQL is embedded in PL/SQL.
There are many ways to re - write the condition. And here's one:
AND ((host_name IN ('SERVERNAMEA', 'SERVERNAMEB', 'SERVERNAMEC')
AND TO_DATE (: StopDate, "MON-DD-YYYY") > = TO_DATE ('22-DEC-2015', "MON-DD-YYYY")
)
OR (host_name IN ('servername1","Nameserver2","SERVERNAME3")
AND TO_DATE (: StopDate, "MON-DD-YYYY")< to_date="" ('dec-22-2015', =""> >
)
)
If: StopDate can be NULL, it must be a bit more complicated.
You can also use nested, such as CASE expressions
AND THE CASE
WHEN TO_DATE (: StopDate, "MON-DD-YYYY") > = TO_DATE ('22-DEC-2015', "MON-DD-YYYY")
WHILE CASE
WHEN host_name IN ('SERVERNAMEA', 'SERVERNAMEB', 'SERVERNAMEC')
AND THEN 'OK '.
END
OTHER CASES
WHEN host_name IN ('servername1","Nameserver2","SERVERNAME3")
AND THEN 'OK '.
END
END = 'OK '.
I wonder if this in your application is the best way, however. If SERVERNAMEA was put into service on December 22, maybe that that fact should be recorded in a table. If you have a table with 1 row per server, you can consider adding 2 columns DATE to show when the server was first and last used. Then, rather than use a WHERE clause to test servers appropriate, you could do an inner join.
Maybe you are looking for
-
Hello I have 5 idevices and all on the same Apple ID account and iCloud. now my iPhone of fathers 5s got paired with my iPhone 6 sound and call of mine newspapers come combined I don't know what to do, when I ask Siri who has iphone is then Sometimes
-
Problem with install/uninstall IntelliPoint 6.1
Recently bought a Wireless Notebook Laser Mouse 7000 MS. Tried to install Intellipoint 7.0 Microsoft.com instead of use the disc that came with the mouse. Received error 1603 when trying to install Intellipoint. Tried to follow the directions of th
-
Upgrades require reinstalling Photoshop and After Effects filters
Confound it Adobe, I have more than 50 third-party filters in Photoshop and After Effects and you are updates always force me to reinstall them. Surely there is a way you can upgrade without wipe these stars every time![As published for the clarity o
-
After the update for 13.7.1, R3D files no longer - work HELP!
Our workflow requires working directly with .r3d files in Premiere and After Effects. Since the update to the latest version of After Effects, we cannot import these files or even use them in projects that were imported. Previously imported files a
-
Reason for high values (more than 100%) for DBhitratio in DS5.2
Hi all In one of our servers to consumer two DS 5.2_patch5 behind the load balancer, the ratio / access DB shows approximately 9900. No tests are very less than not. great success.What is really strange behavior or any sign of setuation bad? Indexing