How to convert the below Oracle Query to DB2. The Query is working fine in Oracle but not in DB2.
Query:
Select f.folder_id, f.identifier
From FOLDER f, STOREENT se
Where f.type = 'AttributeFolder'
And se.storeent_id = f.storeent_id
And se.identifier = 'Global_CAS'
And f.identifier = 10051
connect by prior f.folder_id = f.parentfolder_id
start with f.identifier = 'Categories Descriptors [Global.B2C.Sales]'
Thanks for Ur reply. I tried the same in my env. I get the following error. Can You help where i go wrong.
Query:
with cte as ( select folder_id, f.identifier, cast(null as varchar(255)) parentfolder_id, 0 as depth, se.identifier as se_identifier from folder f join storeent se on se.storeent_id = f.storeent_id where f.identifier = 'A' union all select f.folder_id, f.identifier, f.parentfolder_id, cte.depth + 1 as depth, se.identifier as se_identifier from folder f join storeent se on se.storeent_id = f.storeent_id join cte cte on f.parentfolder_id = cte.folder_id ) Select parentfolder_id, folder_id, identifier, depth from cte
java.sql.SQLSyntaxErrorException: Syntax error: Encountered "with" at line 1, column 1.
connect byandstart withare not a part of ANSI SQL standards.db2set DB2_COMPATIBILITY_VECTOR=ORA