Home » SQL & PL/SQL » SQL & PL/SQL » exists data condition
exists data condition [message #622095] Thu, 21 August 2014 01:39 Go to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi all,

Go to xxc_temp and see if you have data with the number

then go to xxc_transaction and see if the data from xxc_temp is already present.

But if i have data in the both tables it shows me exists, but i don't need this.How to resolve this issue?

thanks
Re: exists data condition [message #622098 is a reply to message #622095] Thu, 21 August 2014 01:51 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
mist598

But if i have data in the both tables it shows me exists, but i don't need this.How to resolve this issue?


What "issue"? If you don't need "this", then simply do nothing.
Re: exists data condition [message #622104 is a reply to message #622098] Thu, 21 August 2014 02:21 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi Littlefoot,

I am getting confusing, how to write condition for below statement?

xxc_transaction and see if the data from xxc_temp is already present.


And if i write Exists condition it shows me already moved data in the xxc_transaction table, that means it struck in the xxc_temp table

[Updated on: Thu, 21 August 2014 02:23]

Report message to a moderator

Re: exists data condition [message #622106 is a reply to message #622104] Thu, 21 August 2014 02:26 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'm sorry, but I don't understand your problem. It smells like SET operators (INTERSECT, MINUS, ...) might help, but I'm not sure. If you could provide test case and explain the problem, someone might assist better than I can.
Re: exists data condition [message #622113 is a reply to message #622095] Thu, 21 August 2014 03:25 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
mist598 wrote on Thu, 21 August 2014 07:39
Hi all,

Go to xxc_temp and see if you have data with the number

then go to xxc_transaction and see if the data from xxc_temp is already present.

But if i have data in the both tables it shows me exists, but i don't need this.How to resolve this issue?

thanks

If the above is a set of requirement that you have been given (and you have supplied a faithful reproduction of those requirements), then they are malformed. The are grammatically incorrect. They appear to be missing salient information and they contain no contesxt. I would personally push back and tell whoever supplied those 'requirements' to make them much clearer.
Re: exists data condition [message #622115 is a reply to message #622113] Thu, 21 August 2014 03:29 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Quote:
If the above is a set of requirement that you have been given (and you have supplied a faithful reproduction of those requirements), then they are malformed. The are grammatically incorrect. They appear to be missing salient information and they contain no contesxt. I would personally push back and tell whoever supplied those 'requirements' to make them much clearer.

Yes Thanks pablolee, let me check please
Re: exists data condition [message #622116 is a reply to message #622115] Thu, 21 August 2014 03:34 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Hi ,

I need the know the data moved FROM xxc_temp TO xxc_transactions AND EXISTS IN the xxc_temp table which are today DATE
I have queried WITH sales_no IN the xxc_transactions TABLE

Re: exists data condition [message #622117 is a reply to message #622116] Thu, 21 August 2014 03:42 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
provide a test case as has been asked of you innumerable times in the past
Re: exists data condition [message #622118 is a reply to message #622117] Thu, 21 August 2014 03:44 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
There are so many columns are there i will check and send u again..Smile
Re: exists data condition [message #622122 is a reply to message #622118] Thu, 21 August 2014 04:11 Go to previous messageGo to next message
Littlefoot
Messages: 21808
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
"Test case" doesn't mean that you have to export your production database and provide a DMP file for us. It is 2 simple tables with no more than 3-4 columns each (in your case) and several sample records.
Re: exists data condition [message #622126 is a reply to message #622116] Thu, 21 August 2014 05:11 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
mist598 wrote on Thu, 21 August 2014 14:04

I need the know the data moved FROM xxc_temp TO xxc_transactions AND EXISTS IN the xxc_temp table which are today DATE


Isn't it a simple join between the two tables?

select temp.<column_list> 
   from xxc_temp temp , xxc_transactions tran
  where temp.<column> = tran.<column>
  and <more joins>
  and temp.<date_column> = sysdate;
Re: exists data condition [message #622128 is a reply to message #622126] Thu, 21 August 2014 05:17 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
Yes Lalit, Thanks and it is related to Apps.

Suppose xxc_temp temp has old values , xxc_transactions also has old values

And if i write the exists condition it gets old and new values existing in the xxc_transactions table.

So for that i need today transaction date
Re: exists data condition [message #622132 is a reply to message #622128] Thu, 21 August 2014 05:28 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
What is with "EXISTS" that makes you so stubborn to use it? I see it as a simple logic. to see the data common in both tables, use simple join. If you want to include the unmatched data, use outer join. If you just want to see the difference, use set operator minus.

So, unless you post something technical and relevant, which is called a test case here, it is impossible to keep guessing based on your explanation in words.
Re: exists data condition [message #622133 is a reply to message #622132] Thu, 21 August 2014 05:35 Go to previous messageGo to next message
mist598
Messages: 1195
Registered: February 2013
Location: Hyderabad
Senior Member
xxc_transaction and see if the data from xxc_temp is already present.
SELECT Count(1) 
FROM   xxc_temp a 
WHERE  EXISTS(SELECT 1 
                FROM xxc_transactions b 
               WHERE join 
                 AND a.date > SYSDATE - 1) 
       AND number = '1234' 
Re: exists data condition [message #622138 is a reply to message #622133] Thu, 21 August 2014 06:21 Go to previous messageGo to next message
pablolee
Messages: 2882
Registered: May 2007
Location: Scotland
Senior Member
The above code is invalid and no test case has been supplied
Re: exists data condition [message #622196 is a reply to message #622133] Fri, 22 August 2014 08:19 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
mist598 wrote on Thu, 21 August 2014 06:35

AND number = '1234'


The above code is also impossible the way you used it as it is a reserved word.

[Updated on: Fri, 22 August 2014 08:20]

Report message to a moderator

Re: exists data condition [message #622208 is a reply to message #622196] Fri, 22 August 2014 09:21 Go to previous messageGo to next message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
@mist598,

Invalid test cases repeatedly, that too after 900+ posts?
Re: exists data condition [message #622210 is a reply to message #622196] Fri, 22 August 2014 09:23 Go to previous message
Lalit Kumar B
Messages: 3174
Registered: May 2013
Location: World Wide on the Web
Senior Member
joy_division wrote on Fri, 22 August 2014 18:49
mist598 wrote on Thu, 21 August 2014 06:35

AND number = '1234'


The above code is also impossible the way you used it as it is a reserved word.


Even the date column name doesn't comply with standards.
Previous Topic: using pivot
Next Topic: datatype of Null
Goto Forum:
  


Current Time: Wed Apr 24 11:57:48 CDT 2024