My question is can I have more than one statement executed inside of a cfquery tag. I am using an Oracle database and I need to insert a row, and get the current order_id for that row that I just inserted. I was told if I do this all in the same session\transaction that it would work. I would do this with two queries, but my worry of course is that I will insert a row, and then another row will be inserted before I get to do my select of the CURRVAL of the row I just inserted.
Is there a way to do this in Cold Fusion? I can do it in Embarcadero's RapidSQL.
The following code does not work.
<cftransaction action="commit"/>
<cfquery name="getOrderID" datasource="#datasource#" username="#username#" password="#password#">
INSERT INTO QADS_ORDERS(QO_ORDER_ID, QO_INSERT_EMPL_ID)
VALUES (qo_order_id_seq.NEXTVAL, 'jl8789')
/
SELECT qo_order_id_seq.CURRVAL as OrderID from dual
</cfquery>
Is there a way to do this in Cold Fusion? I can do it in Embarcadero's RapidSQL.
The following code does not work.
<cftransaction action="commit"/>
<cfquery name="getOrderID" datasource="#datasource#" username="#username#" password="#password#">
INSERT INTO QADS_ORDERS(QO_ORDER_ID, QO_INSERT_EMPL_ID)
VALUES (qo_order_id_seq.NEXTVAL, 'jl8789')
/
SELECT qo_order_id_seq.CURRVAL as OrderID from dual
</cfquery>