Home » SQL & PL/SQL » SQL & PL/SQL » ORACLE
ORACLE [message #193990] Wed, 20 September 2006 05:41 Go to next message
lthomas
Messages: 2
Registered: September 2006
Location: Mumbai
Junior Member
This is MYSQL code:

(SELECT IFNULL((select max(resource_id) from ace_resource),0)+1) as res_id

How to convert above code in Oracle9i
Re: ORACLE [message #193996 is a reply to message #193990] Wed, 20 September 2006 05:57 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Perhaps something like this?

SELECT NVL(MAX(resource_id), 0) + 1 AS res_id FROM ace_resource;

I don't know MySQL, but I *hope* that IFNULL does the same as NVL.
Re: ORACLE [message #193997 is a reply to message #193990] Wed, 20 September 2006 05:58 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Well, without knowing what the MYSQL code does, it's a bit tricky to be certain, but I think this is what you want:

SELECT NVL((select max(resource_id) from ace_resource),0)+1
Re: ORACLE [message #194000 is a reply to message #193990] Wed, 20 September 2006 06:02 Go to previous message
lthomas
Messages: 2
Registered: September 2006
Location: Mumbai
Junior Member
Thanks for the code.
This one was working:
SELECT NVL(MAX(resource_id), 0) + 1 AS res_id FROM ace_resource;

This is not working:
SELECT NVL((select max(resource_id) from ace_resource),0)+1

Any Thank You very much
Previous Topic: recovering lost dba password
Next Topic: Forms Error
Goto Forum:
  


Current Time: Sun Dec 04 16:47:40 CST 2016

Total time taken to generate the page: 0.09980 seconds