EWW. No bind variables (i.e. cfqueryparam) so if there is user input the statement is susceptible to sql injection (another thing SP's take care of).
Regardless, select s.nextval into newid from dual will still break. This would work in a cfquery: DECLARE newid NUMBER; BEGIN select s.nextval into newid from dual; .... etc END; but I don't know why you would bother. Since you need the PL/SQL block you may as well store the prodecure instead so you can get back the id, which was the point in the first place. Or just use the two queries like <cfquery name="nextval" datasource="trademak"> select s.nextval from dual </cfquery> <cfquery name="testinsert" datasource="trademak"> insert into t (id,name) values(#nextval.nextval#,'this is a test') </cfquery> as mentioned earlier. -----Original Message----- From: Kerry [mailto:[EMAIL PROTECTED] Sent: Tuesday, 7 June 2005 11:37 To: CF-Talk Subject: RE: Get New Record ID in ORACLE I have managed to get some SQL that cfquery didnt like to work perfectly using this: <cfscript> factory = CreateObject( "java", "coldfusion.server.ServiceFactory" ); ds = factory.getDataSourceService().getDatasource( "yourdsn" ); conn = ds.getConnection(); stmt = conn.createStatement(); sql = "your funky sql"; stmt.execute( "#sql#" ); stmt.close(); conn.close(); </cfscript> worth a try? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:208818 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

