Hi, i currently build an application using Lucee Hosting provides by HostSinimo. i need a little help on my coding. How to get current oracle sequence number for insert query in one page? Example this is my insert statement
<CFQUERY NAME=”INSERT” DATASOURCE=”MYSOURCE”>
INSERT INTO TABLE (REF_ID,DESC) VALUES (TABLE_SEQ.NEXTVAL,’TESTING’)
</CFQUERY>
I want to get current sequence number
<CFLOCATION URL=”nextpage.cfm?ref=latestsequence“>
can anyone help me regarding this?
your welcome. glad to help.
Splendid, tq taha. you save my day.
Hi azriamin. Thank you for using our hosting for your applications. here’s what I did to get latest sequence id on oracle.
Based on your code
<CFQUERY NAME=”INSERT” DATASOURCE=”MYSOURCE”>
INSERT INTO TABLE (REF_ID,DESC) VALUES (TABLE_SEQ.NEXTVAL,’TESTING’)
</CFQUERY>
Insert This Query Below Your Code
<cfquery name=”val” datasource=”MYSOURCE”>
SELECT TABLE_SEQ.CURRVAL as num FROM DUAL
</cfquery>
<cfoutput>
<CFLOCATION URL=”nextpage.cfm?ref=#val.num#“>
</cfoutput>
I hope this will solve your problem. Feel free to ask anything.