|
-
Nov 23rd, 2001, 05:01 AM
#1
Thread Starter
Junior Member
sql query with case
thsi is the sql server query using case
right now i have hardcoded the values.
but i want this query to be written in oracle, please suggest how to do it. i know i have to use decode instead of case but i am still getting errors.
SELECT 381,t.id, hp.id,
CASE hp.is_bounded WHEN 0 THEN NULL ELSE
(SELECT id FROM hier_prop_value WHERE hier_id = 381 AND hier_prop_id = hp.id AND value = 'republic')
END,
CASE hp.is_bounded WHEN 0 THEN 'secval'
ELSE NULL
END
FROM DUAL, hier_prop hp,term t
WHERE hp.hier_id= 381
AND hp.name = 'Dial UK terms'
AND t.hier_id = 381
AND t.name = 'root 1'
);
This is the oracle sql which i am getting it wrong.
INSERT INTO term_prop (hier_id,term_id,hier_prop_id,hier_prop_value_id,value)
(SELECT
(SELECT 381 FROM DUAL),
(SELECT t.id, hp.id),
SELECT DECODE(hp.is_bounded ,0,NULL ,SELECT id FROM hier_prop_value WHERE hier_id = 381 AND hier_prop_id = 388 AND value = 'republic'),
SELECT DECODE(hp.is_bounded ,0 ,'republic' ,NULL)
FROM DUAL, hier_prop hp,term t
WHERE hp.hier_id= 381
AND hp.name = 'Dial UK terms'
AND t.hier_id = 381
AND t.name = 'root 1'
from dual
);
please i need it urgently. i am new to this.
thankyou
rajiv
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|