> I don't know SPs yet, but that's an interesting idea.  I'll have to look into 
> that when I get time.

Well, it's simple. Here is a working example of how you would do it in
Oracle using a stored procedure:

create table t (id number, colname varchar2(50))
/
create sequence t_seq
start with  1
increment by  1
minvalue  1
maxvalue  99999999
/
create or replace procedure insert_into_t 
   (colname_in in t.colname%type, 
   id_out out t.id%type)
as
begin
   insert into t 
      (id, colname) 
   values 
      (t_seq.nextval, colname_in)
   returning id into id_out;
end;
/

Then in ColdFusion:

<cfstoredproc datasource="dev8native" procedure="insert_into_t">
<cfprocparam type="in" 
    cfsqltype="CF_SQL_VARCHAR" 
    value="hi there">
<cfprocparam type="out" 
    cfsqltype="CF_SQL_INTEGER" 
    variable="id_out">
</cfstoredproc>

<cfoutput>#id_out#</cfoutput>

Of course, you could also just create a "when-insert" trigger on the
table to automatically populate the id column so you do not have to
worry about it in your "insert" statements.
-- 
Eddie Awad.
http://awads.net/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:211550
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

Reply via email to