Re: Insert using an Oracle stored procedure
From: Turkbear (noone_at_nowhere.com)
Date: 03/19/04
- Next message: McKirahan: "Re: Auto generate id?"
- Previous message: Stephen Cairns: "Re: asp recordset"
- In reply to: Luis: "Insert using an Oracle stored procedure"
- Next in thread: Turkbear: "Re: Insert using an Oracle stored procedure"
- Reply: Turkbear: "Re: Insert using an Oracle stored procedure"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 19 Mar 2004 08:54:51 -0600
I sent another poster some info about how we code SP calls in asp ( you need more than just the Sql you have, I
believe):
Here is that info.
Anyway, this is how we populate parameters (from a user entry form) and call the SP ( in this case called
:SNOW_AND_ICE_REPORT_BUILD)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
rid=Request.Form("rnbr")
Begdate=Request.Form("dc1")
EndDate=Request.Form("dc2")
Jnbr=Request.Form("jnum")
Onbr=Request.Form("orgnum")
jrsp=Request.Form("jrcd")
act=Request.Form("actv")
jt=Request.Form("torj")
wonbr=Request.Form("won")
SqlStr = "DECLARE RetVal NUMBER;BEGIN RetVal := SNOW_AND_ICE_REPORT_BUILD ("
SqlStr = SqlStr & rptNbr & ", '"
SqlStr = SqlStr & Jnbr & "', '" & jrsp & "','" & act & "','"
SqlStr = SqlStr & Onbr & "','" & jt & "', 'Y', 'N', 'N'"
If wonbr <> "" then
SqlStr = SqlStr & "," & Cstr(wonbr) & ",'" & BegDate & "','" & EndDate & "')"
Else
SqlStr = SqlStr & ", NULL,'" & BegDate & "','" & EndDate & "')"
End If
SqlStr = SqlStr & ";COMMIT;END; "
conn.Execute(SqlStr)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
It may give some ideas on coding it..
hth
On 19 Mar 2004 04:57:53 -0800, andyza@webmail.co.za (Luis) wrote:
>I'm using the following code to insert a new record into an Oracle
>8.1.7 database using the stored procedure below:
>
>set conn = Server.CreateObject("ADODB.Connection")
>conn.open connStr
>SQLString = "TABLENAME_INSERT_SP(COLID => TABLENAME_SEQ.NEXTVAL,
>COLNAME => '" & tmpName & "', COLSNAME => '" & tmpSname & "',
>COLADDRESS => '" & tmpAddress & "', COLINSTITUTION => '" &
>tmpInstitution & "', COLEDUCATION => '" & tmpEducation & "',
>COLCOMPLETED => '" & tmpCompleted & "', COLLEVEL => '" & tmpLevel &
>"', COLCREDITS => '" & tmpCredits & "')"
>conn.execute(SQLString)
>
>The stored procedure is similar to:
>
>PROCEDURE TABLENAME_INSERT IS
>
> COLID VARCHAR(50);
> COLNAME VARCHAR(50);
> COLSNAME VARCHAR(20);
> COLADDRESS VARCHAR(50);
> COLINSTITUTION VARCHAR(50);
> COLEDUCATION VARCHAR(20);
> COLCOMPLETED VARCHAR(3);
> COLLEVEL NUMBER(4);
> COLCREDITS NUMBER(4);
>
>BEGIN
> INSERT INTO TABLENAME
> (COLID,COLNAME,COLSNAME,COLADDRESS,COLINSTITUTION,COLEDUCATION,COLCOMPLETED,COLLEVEL,COLCREDITS)
> VALUES
> (COLID,COLNAME,COLSNAME,COLADDRESS,COLINSTITUTION,COLEDUCATION,COLCOMPLETED,COLLEVEL,COLCREDITS);
> COMMIT;
>END;
>
>
>When I run the asp code I get the following error:
>
>"Microsoft OLE DB Provider for Oracle (0x80040E14)
>ORA-00900: invalid SQL statement"
>
>What is wrong with my SQL statement?
>
>Could it be a problem with my connection string?
- Next message: McKirahan: "Re: Auto generate id?"
- Previous message: Stephen Cairns: "Re: asp recordset"
- In reply to: Luis: "Insert using an Oracle stored procedure"
- Next in thread: Turkbear: "Re: Insert using an Oracle stored procedure"
- Reply: Turkbear: "Re: Insert using an Oracle stored procedure"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|