View previous topic :: View next topic
|
Author |
Message |
imain Warnings : 1 New User
Joined: 25 Jun 2006 Posts: 14 Location: US
|
|
|
|
Hi All,
I have a problem in hand.
I need to see whether data exists in DB2 table or not. I need to do the coding in cobol.(embedded)
I don't want to use Count as it will read through the entire table, also I don't want to fetch first record only as it will fetch a record, which i won't use. I just want to see whether data satisfying my where condition exists in the table or not.
i've goggled it and found something like -
IF EXISTS (SQL QUERY)
RETURN 1
ELSE
RETURN 0;
But this piece in not working in mainframe DB2, Is there something like the above exists for mainframe SQL ?
Thank you for your time, |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
But this piece in not working |
as usual the quoted sentence tells absolutely nothing about the issue
an prevents from giving any advice |
|
Back to top |
|
|
imain Warnings : 1 New User
Joined: 25 Jun 2006 Posts: 14 Location: US
|
|
|
|
enrico-sorichetti wrote: |
Quote: |
But this piece in not working |
as usual the quoted sentence tells absolutely nothing about the issue
an prevents from giving any advice |
Sorry buddy,
I meant the given SQL is not getting executed in mainframe environment. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
Quote: |
I meant the given SQL is not getting executed in mainframe environment. |
wow, what a detailed, technical response.
in addition to what enrico has said about not providing any information,
why did you
Quote: |
i've goggled it and found something like -
|
and not look in a DB2 manual? (manual buttons at top of page)
had you, you would have discovered that the garbage you pulled out from google is not IBM.
perhaps:
SELECT 1
into :host-numeric-variable
FROM <your table>
WHERE <your conditions>
IF the sqlcode is +100 the data is not there.
an sqlcode of 0 or -811 would indicate that the data is there.
RTFM[/quote] |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
I meant the given SQL is not getting executed in mainframe environment. |
same comment ... |
|
Back to top |
|
|
imain Warnings : 1 New User
Joined: 25 Jun 2006 Posts: 14 Location: US
|
|
|
|
enrico-sorichetti wrote: |
Quote: |
I meant the given SQL is not getting executed in mainframe environment. |
same comment ... |
Ok..Guys Relax,
-------------------------------------------------------------------------------------
WORLD WILL BE A BETTER PLACE, IF YOU TOLD LESS COMPLAINTS RATHER THAN BLAMING |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
we are relaxed, otherwise we would not be wasting our time to try to help You..
our queries work, the Db2 tables do not need any recovery, out threads are not in a deadlock...
and we have no need to ask a forum.... |
|
Back to top |
|
|
imain Warnings : 1 New User
Joined: 25 Jun 2006 Posts: 14 Location: US
|
|
|
|
enrico-sorichetti wrote: |
we are relaxed, otherwise we would not be wasting our time to try to help You..
our queries work, the Db2 tables do not need any recovery, out threads are not in a deadlock...
and we have no need to ask a forum.... |
HELPING! Is this what you call?
hahahah |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
I am trying to make You understand how to post sensible question in order to get useful answers.
and is a way to help You, to get useful answers in the shortest time
both my replies pointed out an illogic way of asking |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
HELPING! Is this what you call? |
Yes, certainly. . .
Demonstrating or pointing out completely non-productive and time-wasting ways to ask for help should help both you as well as others who might not understand how to ask for help without requiring a number of iterations.
If no one told you how bad this approach was, others might read this and believe it is proper to ask for help this way.
And it is not. . . |
|
Back to top |
|
|
rockish
Active User
Joined: 05 Jun 2009 Posts: 185 Location: Planet Earth
|
|
|
|
imain wrote: |
enrico-sorichetti wrote: |
we are relaxed, otherwise we would not be wasting our time to try to help You..
our queries work, the Db2 tables do not need any recovery, out threads are not in a deadlock...
and we have no need to ask a forum.... |
HELPING! Is this what you call?
hahahah |
You are right.. Even I dont see it as HELPING.. Probably I would call it as GUIDING.. after all forums are to guide us to perfection |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10886 Location: italy
|
|
|
|
Quote: |
You are right.. Even I dont see it as HELPING.. Probably I would call it as GUIDING.. after all forums are to guide us to perfection |
if You had read the whole topic You would have seen that the TS did not give any useful info on his issue an was only whining about...
Quote: |
But this piece in not working |
and
Quote: |
I meant the given SQL is not getting executed in mainframe environment. |
just think about...
if You were a manager would You accept Your employees wasting "billing" consultants time with badly posed questions
meditate about it, but most probably not
here an even wore aspect emerges,
anybody can waste somebody else time because they do not pay for it..
and furthermore we get <******>remarks when we try to correct the
approach!
looks like this time You just did not behave according to Your signature |
|
Back to top |
|
|
|