style=3D'font-size:10.0pt;
font-family:Arial'>Hello,
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>We are currently porting to Postgres from SQL Server =
and are
experiencing problems with
w:st=3D"on">ADO
and returning refcursors. We currently use the parameterized =
w:st=3D"on">ADO =
methodology to return
our data from procedures in the database. After researching and
converting over our database to postgres, we are trying to re-use as =
much of
our logic as we can. As currently configured, we return a =
refcursor as an
out parameter from the procedure, and try to return the data into an =
w:st=3D"on">ADO resultset. =
From
further research, we found methodology to call our procedure and return =
the
cursor, and then fetch the results into a resultset. Here is the =
current
code:
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>Procedure:
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>CREATE OR REPLACE FUNCTION usp_commhost_get(IN =
sdomain
"varchar", OUT swv_refcur refcursor) =
AS
style=3D'font-size:10.0pt;
font-family:Arial'>$BODY$
style=3D'font-size:10.0pt;
font-family:Arial'>BEGIN
style=3D'font-size:10.0pt;
font-family:Arial'>-- GET SUBDOMAIN COMMUNITY =
DETAILS
style=3D'font-size:10.0pt;
font-family:Arial'> open swv_RefCur for SELECT =
C.ccPublicCommID
FROM tbl_Comm C WHERE(LOWER(C.ccDomain) =3D LOWER(sdomain) OR =
C.ccDomain =3D
'change_me') AND(C.ccStatusID =3D 1);
style=3D'font-size:10.0pt;
font-family:Arial'> RETURN;
style=3D'font-size:10.0pt;
font-family:Arial'>END; $BODY$
style=3D'font-size:10.0pt;
font-family:Arial'> LANGUAGE 'plpgsql' =
VOLATILE;
style=3D'font-size:10.0pt;
font-family:Arial'>ALTER FUNCTION usp_commhost_get(IN sdomain =
"varchar",
OUT swv_refcur refcursor) OWNER TO =
postgres;
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>ASP code
style=3D'font-size:10.0pt;
font-family:Arial'>
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier New"'><!--#include
virtual=3D"/global/constants.html"-->
t>
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'><html>
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'><head></head>
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'><body>
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'><%
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier New"'>dim conn, rst, =
cmd
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'>
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier New"'>set conn =3D
server.createobject("ADOdb.connection")
>
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier New"'>conn.open =
"Data
Source=3Dpssam1;location=3DConnect3_0;UserID=3Dusername;pass word=3Dpasswo=
rd;"
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier New"'>Set cmd =3D
Server.CreateObject("ADODB.Command")=
p>
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'>cmd.ActiveConnection =3D conn
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier New"'>cmd.CommandText =3D
"select usp_commhost_get('refcur', 'localhost'); FETCH ALL IN
refcur;"
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier New"'>set rst =3D
server.createobject("ADOdb.recordset")=
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier New"'>Set rst=3D =
cmd.Execute
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'>
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier New"'>do until =
rst.eof
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'> response.write
Server.HTMLEncode(rst.fields(0))&"<BR>"
pan>
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier New"'> =
rst.movenext
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'>loop
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'>rst.Close
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'>conn.Close
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'>
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'>%>
face=3D"Courier New">
style=3D'font-size:10.0pt;font-family:"Courier =
New"'></body>
style=3D'font-size:10.0pt;
font-family:"Courier New"'></html>
face=3DArial>
style=3D'font-size:10.0pt;font-family:Arial'>
>
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>We would like to convert this into a parameterized =
call to
the procedure, and not have to stipulate the cursor name to retrieve the =
data. Is
this possible? And if so, what is the proper format? Thank =
you for
any help in advance.
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>Sam Thukral
style=3D'font-size:10.0pt;
font-family:Arial'>Centercode
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>
style=3D'font-size:10.0pt;
font-family:Arial'>