View previous topic :: View next topic
|
Author |
Message |
santsark
New User
Joined: 08 Aug 2008 Posts: 9 Location: Kolkata
|
|
|
|
I'm trying to verify if a value is present in the table before inserting. So i want to write a select statement but do not use any host variable. Is it possible,
like select
from table
where Column_A = :WS-A
I will then evaluate the sql code and determine if I need to insert or not.
I can not change table constraints like unique keys and all, so this is the only solution.
Please let me know if i can write a select statement without the into clause. I'm getting pre-compiler error now. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
You might use an IF EXISTS and use a COUNT in the select. . . |
|
Back to top |
|
|
i_suman
New User
Joined: 01 Mar 2005 Posts: 20
|
|
|
|
I think you can try this too
SELECT '1'
FROM tablename
WHERE column1 = :ws-var
FETCH FIRST 1 ROW ONLY
Anyone, please correct me if I am wrong.
Thanks
Suma |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I think you can try this too |
Anything can be tried. . .
Did you test this before posting? What was the result?
If you did not test this, please do so now and post back the outcome. The test needs to be within a cobol program, not spufi.
It is far too easy to test something like this before posting and then post the result as well as the suggested syntax. . . |
|
Back to top |
|
|
|