0

Hi,

I am converting one query from SQLServer to oracle i get some error related to Exists clause. what i need to do. Date related change i tried in oracle. all subquery return row and i got error on first line.

Thanks in advance

This is the SQL Server Code:

IF EXISTS(select uniqueid from contract where contract_id = 'AL00038900' and contract_year = 7)
BEGIN
IF NOT EXISTS
(
select uniqueid
from contract
where
contract_id = 'AL00038900' and
contract_year = 7 and
contract_name = 'Colonial Bank, N.A.' and
contract_start = '2006-03-01'
)
BEGIN
UPDATE contract
SET
contract_name = 'Colonial Bank, N.A.',
contract_start = '2006-03-01 00:00:00.000',
contract_end = '2007-02-28'
WHERE uniqueid =
(
select uniqueid
from contract
where contract_id = 'AL00038900' and contract_year = 7
)
END
END
ELSE
BEGIN
INSERT INTO
contract
(
contract_id, contract_year, contract_name, contract_start, contract_end
)
VALUES
(
@contract_id, @contract_year, @contract_name, @contract_start, @contract_end
)
END

3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by br_astronut
0

Hi, Thanks for your response. I tried this but not worked, In this query i used only single table. i want to do this without help of procedure. Is ther any option to do that ?

0

Is this a one time procedure or something that will have to be done again and again? Where is the source data for the INSERTS coming from?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.