osdir.com
mailing list archive F.A.Q. -since 2001!



Subject: Re: how to call owa_util.showpage, or dbms_output
to get the contents of a web page? - msg#00015

List: python.db.cx-oracle

Mail Archive Navigation:
by Date: Prev Next Date Index by Thread: Prev Next Thread Index

I can't run htp but I can run dbms_output and I have provided a script
here that does it for your benefit. That should help you figure out
where to go from here. See the reference documentation for more
information or ask again if you really run stuck.

import cx_Oracle

connection = cx_Oracle.Connection("user/pw@dns")
cursor = connection.cursor()
cursor.callproc("dbms_output.enable")
cursor.callproc("dbms_output.put_line", ("hi there",))
cursor.callproc("dbms_output.put_line", ("and goodbye",))
cursor.callproc("dbms_output.put_line", ("wait a minute",))

# one way of doing it
if 0:
statusVar = cursor.var(cx_Oracle.NUMBER)
lineVar = cursor.var(cx_Oracle.STRING)
while True:
cursor.callproc("dbms_output.get_line", (lineVar, statusVar))
if statusVar.getvalue() != 0:
break
print lineVar.getvalue()

# using an array
if 1:
numLinesVar = cursor.var(cx_Oracle.NUMBER)
linesVar = cursor.arrayvar(cx_Oracle.STRING, 2)
while True:
numLinesVar.setvalue(0, 2)
cursor.callproc("dbms_output.get_lines", (linesVar, numLinesVar))
numLines = int(numLinesVar.getvalue())
if numLines == 0:
break
for line in linesVar.getvalue()[:numLines]:
print line

On 2/8/07, John_Nowlan <john_nowlan-dmoCqaWXHRUsA/PxXw9srA@xxxxxxxxxxxxxxxx>
wrote:
>
>
> O.k. I seem to be having the same problems everyone else has with parameters
> & binding, but I'm still not getting it.
> I have:
>
> CREATE OR REPLACE PROCEDURE webpage
> IS
> BEGIN
> htp.htmlopen;
> htp.headopen;
> htp.htitle('web page');
> htp.headclose;
> htp.bodyopen;
> htp.p('Neato!');
> htp.bodyclose;
> htp.htmlclose;
> END webpage;
> /
>
> From package htp:
> type htbuf_arr is table of varchar2(256) index by binary_integer;
>
> - which looks to me like an oracle array, not an sql datatype so should be
> o.k.?
> - but perhaps is a named datatype which is not supported?
>
> htp.procedure get_page (thepage out htbuf_arr, irows in out integer);
>
> but whatever I try (and I've tried a few variations...) I get things like:
>
> >>> o, i
> ([], 4)
> >>> c.callproc('htp.get_page(:o, :i)', [o, i])
> Traceback (most recent call last):
> File "<interactive input>", line 1, in ?
> DatabaseError: ORA-01008: not all variables bound
>
> or
>
> >>> r = c.execute('begin htp.get_page(:o, :i); end;', p)
> Traceback (most recent call last):
> File "<interactive input>", line 1, in ?
> NotSupportedError: Variable_TypeByValue(): unhandled data type type
> >>> p
> {'i': <type 'cx_Oracle.NUMBER'>, 'o': []}
> >>> p['i'] = 1
> >>> p
> {'i': 1, 'o': []}
> >>> r = c.execute('begin htp.get_page(:o, :i); end;', p)
> >>> r
> >>> p
> {'i': 1, 'o': []}
> >>> p['o'].getvalue()
> Traceback (most recent call last):
> File "<interactive input>", line 1, in ?
> AttributeError: 'list' object has no attribute 'getvalue'
>
>
> - as you can see I'm in a _bit_ over my head.
> - Is there a shorthand for AnyAndAllHelpAppreciated? AAAHA
>
> and Thanks for cx_Oracle
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job
> easier.
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> cx-oracle-users mailing list
> cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users
>
>

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


Thread at a glance:

Previous Message by Date:

Re: how to call owa_util.showpage, or dbms_output to get the contents of a web page?

O.k. I seem to be having the same problems everyone else has with parameters & binding, but I'm still not getting it. I have:   CREATE OR REPLACE PROCEDURE webpage   IS   BEGIN    htp.htmlopen;    htp.headopen;    htp.htitle('web page');    htp.headclose;    htp.bodyopen;    htp.p('Neato!');    htp.bodyclose;    htp.htmlclose;   END webpage;/   From package htp: type htbuf_arr is table of varchar2(256) index by binary_integer;   - which looks to me like an oracle array, not an sql datatype so should be o.k.? - but perhaps is a named datatype which is not supported?   htp.procedure get_page (thepage out htbuf_arr, irows in out integer);   but whatever I try (and I've tried a few variations...) I get things like:   >>> o, i([], 4)>>> c.callproc('htp.get_page(:o, :i)', [o, i])Traceback (most recent call last):  File "<interactive input>", line 1, in ?DatabaseError: ORA-01008: not all variables bound   or   >>> r = c.execute('begin htp.get_page(:o, :i); end;', p)Traceback (most recent call last):  File "<interactive input>", line 1, in ?NotSupportedError: Variable_TypeByValue(): unhandled data type type>>> p{'i': <type 'cx_Oracle.NUMBER'>, 'o': []}>>> p['i'] = 1>>> p{'i': 1, 'o': []}>>> r = c.execute('begin htp.get_page(:o, :i); end;', p)>>> r>>> p{'i': 1, 'o': []}>>> p['o'].getvalue()Traceback (most recent call last):  File "<interactive input>", line 1, in ?AttributeError: 'list' object has no attribute 'getvalue'     - as you can see I'm in a _bit_ over my head. - Is there a shorthand for AnyAndAllHelpAppreciated? AAAHA   and Thanks for cx_Oracle   ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642_______________________________________________ cx-oracle-users mailing list cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/cx-oracle-users

Next Message by Date:

Re: how to call owa_util.showpage, or dbms_output to get the contents of a web page?

FWIW see my post at the bottom of: http://forums.oracle.com/forums/thread.jspa?messageID=1625605#1625605 Chris Anthony Tuininga wrote: > I can't run htp but I can run dbms_output and I have provided a script > here that does it for your benefit. That should help you figure out > where to go from here. See the reference documentation for more > information or ask again if you really run stuck. > > import cx_Oracle > > connection = cx_Oracle.Connection("user/pw@dns") > cursor = connection.cursor() > cursor.callproc("dbms_output.enable") > cursor.callproc("dbms_output.put_line", ("hi there",)) > cursor.callproc("dbms_output.put_line", ("and goodbye",)) > cursor.callproc("dbms_output.put_line", ("wait a minute",)) > > # one way of doing it > if 0: > statusVar = cursor.var(cx_Oracle.NUMBER) > lineVar = cursor.var(cx_Oracle.STRING) > while True: > cursor.callproc("dbms_output.get_line", (lineVar, statusVar)) > if statusVar.getvalue() != 0: > break > print lineVar.getvalue() > > # using an array > if 1: > numLinesVar = cursor.var(cx_Oracle.NUMBER) > linesVar = cursor.arrayvar(cx_Oracle.STRING, 2) > while True: > numLinesVar.setvalue(0, 2) > cursor.callproc("dbms_output.get_lines", (linesVar, numLinesVar)) > numLines = int(numLinesVar.getvalue()) > if numLines == 0: > break > for line in linesVar.getvalue()[:numLines]: > print line > > On 2/8/07, John_Nowlan <john_nowlan-dmoCqaWXHRUsA/PxXw9srA@xxxxxxxxxxxxxxxx> > wrote: >> >> O.k. I seem to be having the same problems everyone else has with parameters >> & binding, but I'm still not getting it. >> I have: >> >> CREATE OR REPLACE PROCEDURE webpage >> IS >> BEGIN >> htp.htmlopen; >> htp.headopen; >> htp.htitle('web page'); >> htp.headclose; >> htp.bodyopen; >> htp.p('Neato!'); >> htp.bodyclose; >> htp.htmlclose; >> END webpage; >> / >> >> From package htp: >> type htbuf_arr is table of varchar2(256) index by binary_integer; >> >> - which looks to me like an oracle array, not an sql datatype so should be >> o.k.? >> - but perhaps is a named datatype which is not supported? >> >> htp.procedure get_page (thepage out htbuf_arr, irows in out integer); >> >> but whatever I try (and I've tried a few variations...) I get things like: >> >>>>> o, i >> ([], 4) >>>>> c.callproc('htp.get_page(:o, :i)', [o, i]) >> Traceback (most recent call last): >> File "<interactive input>", line 1, in ? >> DatabaseError: ORA-01008: not all variables bound >> >> or >> >>>>> r = c.execute('begin htp.get_page(:o, :i); end;', p) >> Traceback (most recent call last): >> File "<interactive input>", line 1, in ? >> NotSupportedError: Variable_TypeByValue(): unhandled data type type >>>>> p >> {'i': <type 'cx_Oracle.NUMBER'>, 'o': []} >>>>> p['i'] = 1 >>>>> p >> {'i': 1, 'o': []} >>>>> r = c.execute('begin htp.get_page(:o, :i); end;', p) >>>>> r >>>>> p >> {'i': 1, 'o': []} >>>>> p['o'].getvalue() >> Traceback (most recent call last): >> File "<interactive input>", line 1, in ? >> AttributeError: 'list' object has no attribute 'getvalue' >> >> >> - as you can see I'm in a _bit_ over my head. >> - Is there a shorthand for AnyAndAllHelpAppreciated? AAAHA >> >> and Thanks for cx_Oracle >> >> ------------------------------------------------------------------------- >> Using Tomcat but need to do more? Need to support web services, security? >> Get stuff done quickly with pre-integrated technology to make your job >> easier. >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> cx-oracle-users mailing list >> cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > cx-oracle-users mailing list > cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users -- Christopher Jones, Oracle Email: Christopher.Jones-QHcLZuEGTsvQT0dZR+AlfA@xxxxxxxxxxxxxxxx Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

Previous Message by Thread:

Re: how to call owa_util.showpage, or dbms_output to get the contents of a web page?

O.k. I seem to be having the same problems everyone else has with parameters & binding, but I'm still not getting it. I have:   CREATE OR REPLACE PROCEDURE webpage   IS   BEGIN    htp.htmlopen;    htp.headopen;    htp.htitle('web page');    htp.headclose;    htp.bodyopen;    htp.p('Neato!');    htp.bodyclose;    htp.htmlclose;   END webpage;/   From package htp: type htbuf_arr is table of varchar2(256) index by binary_integer;   - which looks to me like an oracle array, not an sql datatype so should be o.k.? - but perhaps is a named datatype which is not supported?   htp.procedure get_page (thepage out htbuf_arr, irows in out integer);   but whatever I try (and I've tried a few variations...) I get things like:   >>> o, i([], 4)>>> c.callproc('htp.get_page(:o, :i)', [o, i])Traceback (most recent call last):  File "<interactive input>", line 1, in ?DatabaseError: ORA-01008: not all variables bound   or   >>> r = c.execute('begin htp.get_page(:o, :i); end;', p)Traceback (most recent call last):  File "<interactive input>", line 1, in ?NotSupportedError: Variable_TypeByValue(): unhandled data type type>>> p{'i': <type 'cx_Oracle.NUMBER'>, 'o': []}>>> p['i'] = 1>>> p{'i': 1, 'o': []}>>> r = c.execute('begin htp.get_page(:o, :i); end;', p)>>> r>>> p{'i': 1, 'o': []}>>> p['o'].getvalue()Traceback (most recent call last):  File "<interactive input>", line 1, in ?AttributeError: 'list' object has no attribute 'getvalue'     - as you can see I'm in a _bit_ over my head. - Is there a shorthand for AnyAndAllHelpAppreciated? AAAHA   and Thanks for cx_Oracle   ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642_______________________________________________ cx-oracle-users mailing list cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/cx-oracle-users

Next Message by Thread:

Re: how to call owa_util.showpage, or dbms_output to get the contents of a web page?

FWIW see my post at the bottom of: http://forums.oracle.com/forums/thread.jspa?messageID=1625605#1625605 Chris Anthony Tuininga wrote: > I can't run htp but I can run dbms_output and I have provided a script > here that does it for your benefit. That should help you figure out > where to go from here. See the reference documentation for more > information or ask again if you really run stuck. > > import cx_Oracle > > connection = cx_Oracle.Connection("user/pw@dns") > cursor = connection.cursor() > cursor.callproc("dbms_output.enable") > cursor.callproc("dbms_output.put_line", ("hi there",)) > cursor.callproc("dbms_output.put_line", ("and goodbye",)) > cursor.callproc("dbms_output.put_line", ("wait a minute",)) > > # one way of doing it > if 0: > statusVar = cursor.var(cx_Oracle.NUMBER) > lineVar = cursor.var(cx_Oracle.STRING) > while True: > cursor.callproc("dbms_output.get_line", (lineVar, statusVar)) > if statusVar.getvalue() != 0: > break > print lineVar.getvalue() > > # using an array > if 1: > numLinesVar = cursor.var(cx_Oracle.NUMBER) > linesVar = cursor.arrayvar(cx_Oracle.STRING, 2) > while True: > numLinesVar.setvalue(0, 2) > cursor.callproc("dbms_output.get_lines", (linesVar, numLinesVar)) > numLines = int(numLinesVar.getvalue()) > if numLines == 0: > break > for line in linesVar.getvalue()[:numLines]: > print line > > On 2/8/07, John_Nowlan <john_nowlan-dmoCqaWXHRUsA/PxXw9srA@xxxxxxxxxxxxxxxx> > wrote: >> >> O.k. I seem to be having the same problems everyone else has with parameters >> & binding, but I'm still not getting it. >> I have: >> >> CREATE OR REPLACE PROCEDURE webpage >> IS >> BEGIN >> htp.htmlopen; >> htp.headopen; >> htp.htitle('web page'); >> htp.headclose; >> htp.bodyopen; >> htp.p('Neato!'); >> htp.bodyclose; >> htp.htmlclose; >> END webpage; >> / >> >> From package htp: >> type htbuf_arr is table of varchar2(256) index by binary_integer; >> >> - which looks to me like an oracle array, not an sql datatype so should be >> o.k.? >> - but perhaps is a named datatype which is not supported? >> >> htp.procedure get_page (thepage out htbuf_arr, irows in out integer); >> >> but whatever I try (and I've tried a few variations...) I get things like: >> >>>>> o, i >> ([], 4) >>>>> c.callproc('htp.get_page(:o, :i)', [o, i]) >> Traceback (most recent call last): >> File "<interactive input>", line 1, in ? >> DatabaseError: ORA-01008: not all variables bound >> >> or >> >>>>> r = c.execute('begin htp.get_page(:o, :i); end;', p) >> Traceback (most recent call last): >> File "<interactive input>", line 1, in ? >> NotSupportedError: Variable_TypeByValue(): unhandled data type type >>>>> p >> {'i': <type 'cx_Oracle.NUMBER'>, 'o': []} >>>>> p['i'] = 1 >>>>> p >> {'i': 1, 'o': []} >>>>> r = c.execute('begin htp.get_page(:o, :i); end;', p) >>>>> r >>>>> p >> {'i': 1, 'o': []} >>>>> p['o'].getvalue() >> Traceback (most recent call last): >> File "<interactive input>", line 1, in ? >> AttributeError: 'list' object has no attribute 'getvalue' >> >> >> - as you can see I'm in a _bit_ over my head. >> - Is there a shorthand for AnyAndAllHelpAppreciated? AAAHA >> >> and Thanks for cx_Oracle >> >> ------------------------------------------------------------------------- >> Using Tomcat but need to do more? Need to support web services, security? >> Get stuff done quickly with pre-integrated technology to make your job >> easier. >> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> _______________________________________________ >> cx-oracle-users mailing list >> cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > cx-oracle-users mailing list > cx-oracle-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@xxxxxxxxxxxxxxxx > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users -- Christopher Jones, Oracle Email: Christopher.Jones-QHcLZuEGTsvQT0dZR+AlfA@xxxxxxxxxxxxxxxx Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
blog comments powered by Disqus

Home | News | Sitemap | FAQ | advertise | OSDir is an Inevitable website. GBiz is too!