inserting XML Document into Oracle database using a stored procedure
inserting XML Document into Oracle database using a stored procedure
am 02.03.2006 05:43:14 von hariharan.venkata-chinnaswamy
------_=_NextPart_001_01C63DB4.0768C57B
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
I am trying to insert a XMLType Xmldom.DOMDocument into the Oracle
database and I am stuck. Thanks in advance for any pointers.
=20
=20
Here is my stored procedure. The first parameter in the checkin_design
stored procedure is a DOM object type parameter. The rest of the
parameters are regular strings.
=20
=20
=20
PROCEDURE checkin_design( in_designinfo_doc IN Xmldom.DOMDocument,=20
in_design_tag IN DESIGN_TAG.TAG%TYPE,
in_username IN
DESIGN.created_by%TYPE,=20
out_message OUT VARCHAR2) IS
=20
v_result BOOLEAN :=3D FALSE;
v_proc VARCHAR2(500) :=3D 'CHECKIN_DESIGN-1';
BEGIN
v_result :=3D checkin_design (in_designinfo_doc
,in_design_tag
,in_username
,out_message);
EXCEPTION
WHEN OTHERS THEN
v_error_stack :=3D DBMS_UTILITY.format_error_stack;
v_error_call :=3D DBMS_UTILITY.format_call_stack;
v_ora_errno :=3D SQLCODE;
v_ora_errmsg :=3D SUBSTR ( SQLERRM, 0, 255 );
v_db_object :=3D v_db_object||'.'||v_proc;
v_additional_info :=3D '[PARAMETERS] in_designinfo_doc=3D[DOM
Document], in_design_tag=3D'||in_design_tag||',
in_username=3D'||in_username;
Error_Monitor.log_error ( v_db_schema
,v_application
,v_db_object
,565
,v_ora_errno
,v_ora_errmsg
,'Unhandled exception in
'||v_db_object||'.'||v_proc
,v_username
,SYSDATE
,1
,v_error_stack
,v_error_call
,v_additional_info
,'Y' );
out_message :=3D v_ora_errmsg;
END checkin_design;
=20
=20
=20
Here is my perl script
=20
=20
=20
#! /tools/xgs/perl/5.8.5/bin/perl
=20
use strict;
use lib "/tools/xgs/perl/5.8.5/lib/dbd/oracle/8.1.7/lib";
use DBI;
use XML::DOM;
use DBD::Oracle qw(:ora_types);
=20
$ENV{'ORACLE_HOME'} =3D '/mis/TREE/oracle/5prod/8.1.7';
=20
my $dbh =3D DBI->connect('dbi:Oracle:ubmdev.ir.xilinx',
'xxx',
'xxxxxxx',
{RaiseError =3D> 1, AutoCommit =3D> 1}) || die
"cannot connect:$DBI::errstr";
=20
print "connected to DB\n";
=20
my $infile =3D "designInfo.xml";
my $dom_parser =3D new XML::DOM::Parser;
my $doc =3D $dom_parser->parsefile($infile);=20
my $nodes =3D $doc->getElementsByTagName ("designInfo");
=20
my $err1;
my $func1;
eval {
$func1 =3D $dbh->prepare(q{
BEGIN
DESIGN_PKG.checkin_design(:param1, :param2, :param3, :error);
END;
});
=20
$func1->bind_param_inout(":error",\$err1,500);
$func1->bind_param(":param1",$doc->getDocumentElement(), { ora_type =
=3D>
ORA_CLOB });=20
$func1->bind_param(":param2",'head-00134');
$func1->bind_param(":param3",'hvenkata');
=20
$func1->execute;
print "DIAGNOSIS: $DBI::lasth : $DBI::lasth->{Type} :=20
$DBI::lasth->{Statement}\n";
};
=20
if ($@) {
warn "message: $DBI::errstr\n";
warn "message2: " . $func1->errstr() . "\n";
warn "message3: " . $func1->err() . "\n";=20
}
=20
print "store procedure returns $err1\n";
=20
=20
$dbh->disconnect;
=20
=20
What am I doing wrong?
=20
Hari
------_=_NextPart_001_01C63DB4.0768C57B--
Re: inserting XML Document into Oracle database using a stored procedure
am 02.03.2006 11:33:05 von Alexander
Hariharan Venkata-Chinnaswamy wrote:
>I am trying to insert a XMLType Xmldom.DOMDocument into the Oracle
>database and I am stuck. Thanks in advance for any pointers.
>
>
Your post is like going to the doctor and just saying "I'm sick. Cure me."
What exactly is your problem? What exactly do you expect your script to
do? What does it instead? What error messages are returned?
Alexander
--
Alexander Foken
mailto:alexander@foken.de http://www.foken.de/alexander/
RE: inserting XML Document into Oracle database using a stored procedure
am 02.03.2006 21:29:42 von Ron.Reidy
What is happening? What Oracle version, Perl version DBI/DBD::Oracle
versions?
--
Ron Reidy
Lead DBA
Array BioPharma, Inc.
-----Original Message-----
From: Hariharan Venkata-Chinnaswamy
[mailto:hariharan.venkata-chinnaswamy@xilinx.com]=20
Sent: Wednesday, March 01, 2006 9:43 PM
To: dbi-users@perl.org
Subject: inserting XML Document into Oracle database using a stored
procedure
I am trying to insert a XMLType Xmldom.DOMDocument into the Oracle
database and I am stuck. Thanks in advance for any pointers.
=20
=20
Here is my stored procedure. The first parameter in the checkin_design
stored procedure is a DOM object type parameter. The rest of the
parameters are regular strings.
=20
=20
=20
PROCEDURE checkin_design( in_designinfo_doc IN Xmldom.DOMDocument,=20
in_design_tag IN DESIGN_TAG.TAG%TYPE,
in_username IN
DESIGN.created_by%TYPE,=20
out_message OUT VARCHAR2) IS
=20
v_result BOOLEAN :=3D FALSE;
v_proc VARCHAR2(500) :=3D 'CHECKIN_DESIGN-1';
BEGIN
v_result :=3D checkin_design (in_designinfo_doc
,in_design_tag
,in_username
,out_message);
EXCEPTION
WHEN OTHERS THEN
v_error_stack :=3D DBMS_UTILITY.format_error_stack;
v_error_call :=3D DBMS_UTILITY.format_call_stack;
v_ora_errno :=3D SQLCODE;
v_ora_errmsg :=3D SUBSTR ( SQLERRM, 0, 255 );
v_db_object :=3D v_db_object||'.'||v_proc;
v_additional_info :=3D '[PARAMETERS] in_designinfo_doc=3D[DOM
Document], in_design_tag=3D'||in_design_tag||',
in_username=3D'||in_username;
Error_Monitor.log_error ( v_db_schema
,v_application
,v_db_object
,565
,v_ora_errno
,v_ora_errmsg
,'Unhandled exception in
'||v_db_object||'.'||v_proc
,v_username
,SYSDATE
,1
,v_error_stack
,v_error_call
,v_additional_info
,'Y' );
out_message :=3D v_ora_errmsg;
END checkin_design;
=20
=20
=20
Here is my perl script
=20
=20
=20
#! /tools/xgs/perl/5.8.5/bin/perl
=20
use strict;
use lib "/tools/xgs/perl/5.8.5/lib/dbd/oracle/8.1.7/lib";
use DBI;
use XML::DOM;
use DBD::Oracle qw(:ora_types);
=20
$ENV{'ORACLE_HOME'} =3D '/mis/TREE/oracle/5prod/8.1.7';
=20
my $dbh =3D DBI->connect('dbi:Oracle:ubmdev.ir.xilinx',
'xxx',
'xxxxxxx',
{RaiseError =3D> 1, AutoCommit =3D> 1}) || die
"cannot connect:$DBI::errstr";
=20
print "connected to DB\n";
=20
my $infile =3D "designInfo.xml";
my $dom_parser =3D new XML::DOM::Parser;
my $doc =3D $dom_parser->parsefile($infile);=20
my $nodes =3D $doc->getElementsByTagName ("designInfo");
=20
my $err1;
my $func1;
eval {
$func1 =3D $dbh->prepare(q{
BEGIN
DESIGN_PKG.checkin_design(:param1, :param2, :param3, :error);
END;
});
=20
$func1->bind_param_inout(":error",\$err1,500);
$func1->bind_param(":param1",$doc->getDocumentElement(), { ora_type =
=3D>
ORA_CLOB });=20
$func1->bind_param(":param2",'head-00134');
$func1->bind_param(":param3",'hvenkata');
=20
$func1->execute;
print "DIAGNOSIS: $DBI::lasth : $DBI::lasth->{Type} :=20
$DBI::lasth->{Statement}\n";
};
=20
if ($@) {
warn "message: $DBI::errstr\n";
warn "message2: " . $func1->errstr() . "\n";
warn "message3: " . $func1->err() . "\n";=20
}
=20
print "store procedure returns $err1\n";
=20
=20
$dbh->disconnect;
=20
=20
What am I doing wrong?
=20
Hari
This electronic message transmission is a PRIVATE communication which =
contains
information which may be confidential or privileged. The information is =
intended=20
to be for the use of the individual or entity named above. If you are =
not the=20
intended recipient, please be aware that any disclosure, copying, =
distribution=20
or use of the contents of this information is prohibited. Please notify =
the
sender of the delivery error by replying to this message, or notify us =
by
telephone (877-633-2436, ext. 0), and then delete it from your system.
Re: inserting XML Document into Oracle database using a stored procedure
am 02.03.2006 23:51:09 von hariharan.venkata-chinnaswamy
Here is the version information
Perl Verion is 5.8.5
Oracle client version is 9.0
DBI version is 1.45
DBD::Oracle version is 1.15
The problem is that i am not getting any errors. The database is not
being called it errors out before that so there is no error message.
What i am trying to do is i want to insert a xml file into the Oracle
database using a stored procedure which takes a XmlType type parameter.
How do i create a DOM object to be binded using the bind_param method?
Hari
Reidy, Ron wrote:
>What is happening? What Oracle version, Perl version DBI/DBD::Oracle
>versions?
>
>--
>Ron Reidy
>Lead DBA
>Array BioPharma, Inc.
>
>-----Original Message-----
>From: Hariharan Venkata-Chinnaswamy
>[mailto:hariharan.venkata-chinnaswamy@xilinx.com]
>Sent: Wednesday, March 01, 2006 9:43 PM
>To: dbi-users@perl.org
>Subject: inserting XML Document into Oracle database using a stored
>procedure
>
>
>I am trying to insert a XMLType Xmldom.DOMDocument into the Oracle
>database and I am stuck. Thanks in advance for any pointers.
>
>
>
>
>
>Here is my stored procedure. The first parameter in the checkin_design
>stored procedure is a DOM object type parameter. The rest of the
>parameters are regular strings.
>
>
>
>
>
>
>
>PROCEDURE checkin_design( in_designinfo_doc IN Xmldom.DOMDocument,
>
> in_design_tag IN DESIGN_TAG.TAG%TYPE,
>
> in_username IN
>DESIGN.created_by%TYPE,
>
> out_message OUT VARCHAR2) IS
>
>
>
> v_result BOOLEAN := FALSE;
>
> v_proc VARCHAR2(500) := 'CHECKIN_DESIGN-1';
>
>BEGIN
>
> v_result := checkin_design (in_designinfo_doc
>
> ,in_design_tag
>
> ,in_username
>
> ,out_message);
>
>EXCEPTION
>
> WHEN OTHERS THEN
>
> v_error_stack := DBMS_UTILITY.format_error_stack;
>
> v_error_call := DBMS_UTILITY.format_call_stack;
>
> v_ora_errno := SQLCODE;
>
> v_ora_errmsg := SUBSTR ( SQLERRM, 0, 255 );
>
> v_db_object := v_db_object||'.'||v_proc;
>
> v_additional_info := '[PARAMETERS] in_designinfo_doc=[DOM
>Document], in_design_tag='||in_design_tag||',
>in_username='||in_username;
>
> Error_Monitor.log_error ( v_db_schema
>
> ,v_application
>
> ,v_db_object
>
> ,565
>
> ,v_ora_errno
>
> ,v_ora_errmsg
>
> ,'Unhandled exception in
>'||v_db_object||'.'||v_proc
>
> ,v_username
>
> ,SYSDATE
>
> ,1
>
> ,v_error_stack
>
> ,v_error_call
>
> ,v_additional_info
>
> ,'Y' );
>
> out_message := v_ora_errmsg;
>
>END checkin_design;
>
>
>
>
>
>
>
>Here is my perl script
>
>
>
>
>
>
>
>#! /tools/xgs/perl/5.8.5/bin/perl
>
>
>
>use strict;
>
>use lib "/tools/xgs/perl/5.8.5/lib/dbd/oracle/8.1.7/lib";
>
>use DBI;
>
>use XML::DOM;
>
>use DBD::Oracle qw(:ora_types);
>
>
>
>$ENV{'ORACLE_HOME'} = '/mis/TREE/oracle/5prod/8.1.7';
>
>
>
>my $dbh = DBI->connect('dbi:Oracle:ubmdev.ir.xilinx',
>
> 'xxx',
>
> 'xxxxxxx',
>
> {RaiseError => 1, AutoCommit => 1}) || die
>"cannot connect:$DBI::errstr";
>
>
>
>print "connected to DB\n";
>
>
>
>my $infile = "designInfo.xml";
>
>my $dom_parser = new XML::DOM::Parser;
>
>my $doc = $dom_parser->parsefile($infile);
>
>my $nodes = $doc->getElementsByTagName ("designInfo");
>
>
>
>my $err1;
>
>my $func1;
>
>eval {
>
> $func1 = $dbh->prepare(q{
>
> BEGIN
>
> DESIGN_PKG.checkin_design(:param1, :param2, :param3, :error);
>
> END;
>
> });
>
>
>
> $func1->bind_param_inout(":error",\$err1,500);
>
> $func1->bind_param(":param1",$doc->getDocumentElement(), { ora_type =>
>ORA_CLOB });
>
> $func1->bind_param(":param2",'head-00134');
>
> $func1->bind_param(":param3",'hvenkata');
>
>
>
> $func1->execute;
>
> print "DIAGNOSIS: $DBI::lasth : $DBI::lasth->{Type} :
>
>$DBI::lasth->{Statement}\n";
>
>};
>
>
>
>if ($@) {
>
> warn "message: $DBI::errstr\n";
>
> warn "message2: " . $func1->errstr() . "\n";
>
> warn "message3: " . $func1->err() . "\n";
>
>}
>
>
>
>print "store procedure returns $err1\n";
>
>
>
>
>
>$dbh->disconnect;
>
>
>
>
>
>What am I doing wrong?
>
>
>
>Hari
>
>
>This electronic message transmission is a PRIVATE communication which contains
>information which may be confidential or privileged. The information is intended
>to be for the use of the individual or entity named above. If you are not the
>intended recipient, please be aware that any disclosure, copying, distribution
>or use of the contents of this information is prohibited. Please notify the
>sender of the delivery error by replying to this message, or notify us by
>telephone (877-633-2436, ext. 0), and then delete it from your system.
>
>
>
>
RE: inserting XML Document into Oracle database using a stored procedure
am 03.03.2006 00:02:29 von Ron.Reidy
So, I have a couple of questions.
Why are you parsing the doc? Are you trying to validate it? Have you
tried to eliminate this step and just insert the doc, even as a test?
You say it the database is not being called. So where does the error
occur? I assumed you were having a DB issue, since this is a DBI
mailing list. If your issue is with the XML::DOM::Parser, that is where
you should concentrate your efforts. =20
I have a couple of Perl programs that insert XML documents into a table
with a column type of SYS.XMLType and have never had issues getting them
into the DB.
I would suggest checking that the XML::DOM::Parser methods (if you
really must parse the document) are returning without errors, and
possibly the use of the Perl debugger to resolve the issue.
rr
-----Original Message-----
From: Hariharan Venkata-Chinnaswamy
[mailto:hariharan.venkata-chinnaswamy@xilinx.com]=20
Sent: Thursday, March 02, 2006 3:51 PM
To: Reidy, Ron
Cc: Hariharan Venkata-Chinnaswamy; dbi-users@perl.org
Subject: Re: inserting XML Document into Oracle database using a stored
procedure
Here is the version information
Perl Verion is 5.8.5
Oracle client version is 9.0
DBI version is 1.45
DBD::Oracle version is 1.15
The problem is that i am not getting any errors. The database is not=20
being called it errors out before that so there is no error message.
What i am trying to do is i want to insert a xml file into the Oracle=20
database using a stored procedure which takes a XmlType type parameter.=20
How do i create a DOM object to be binded using the bind_param method?
Hari
Reidy, Ron wrote:
>What is happening? What Oracle version, Perl version DBI/DBD::Oracle=20
>versions?
>
>--
>Ron Reidy
>Lead DBA
>Array BioPharma, Inc.
>
>-----Original Message-----
>From: Hariharan Venkata-Chinnaswamy=20
>[mailto:hariharan.venkata-chinnaswamy@xilinx.com]
>Sent: Wednesday, March 01, 2006 9:43 PM
>To: dbi-users@perl.org
>Subject: inserting XML Document into Oracle database using a stored=20
>procedure
>
>
>I am trying to insert a XMLType Xmldom.DOMDocument into the Oracle=20
>database and I am stuck. Thanks in advance for any pointers.
>
>=20
>
>=20
>
>Here is my stored procedure. The first parameter in the checkin_design
>stored procedure is a DOM object type parameter. The rest of the=20
>parameters are regular strings.
>
>=20
>
>=20
>
>=20
>
>PROCEDURE checkin_design( in_designinfo_doc IN Xmldom.DOMDocument,
>
> in_design_tag IN
DESIGN_TAG.TAG%TYPE,
>
> in_username IN
>DESIGN.created_by%TYPE,
>
> out_message OUT VARCHAR2) IS
>
>=20
>
> v_result BOOLEAN :=3D FALSE;
>
> v_proc VARCHAR2(500) :=3D 'CHECKIN_DESIGN-1';
>
>BEGIN
>
> v_result :=3D checkin_design (in_designinfo_doc
>
> ,in_design_tag
>
> ,in_username
>
> ,out_message);
>
>EXCEPTION
>
> WHEN OTHERS THEN
>
> v_error_stack :=3D DBMS_UTILITY.format_error_stack;
>
> v_error_call :=3D DBMS_UTILITY.format_call_stack;
>
> v_ora_errno :=3D SQLCODE;
>
> v_ora_errmsg :=3D SUBSTR ( SQLERRM, 0, 255 );
>
> v_db_object :=3D v_db_object||'.'||v_proc;
>
> v_additional_info :=3D '[PARAMETERS] in_designinfo_doc=3D[DOM=20
>Document], in_design_tag=3D'||in_design_tag||',
>in_username=3D'||in_username;
>
> Error_Monitor.log_error ( v_db_schema
>
> ,v_application
>
> ,v_db_object
>
> ,565
>
> ,v_ora_errno
>
> ,v_ora_errmsg
>
> ,'Unhandled exception in=20
>'||v_db_object||'.'||v_proc
>
> ,v_username
>
> ,SYSDATE
>
> ,1
>
> ,v_error_stack
>
> ,v_error_call
>
> ,v_additional_info
>
> ,'Y' );
>
> out_message :=3D v_ora_errmsg;
>
>END checkin_design;
>
>=20
>
>=20
>
>=20
>
>Here is my perl script
>
>=20
>
>=20
>
>=20
>
>#! /tools/xgs/perl/5.8.5/bin/perl
>
>=20
>
>use strict;
>
>use lib "/tools/xgs/perl/5.8.5/lib/dbd/oracle/8.1.7/lib";
>
>use DBI;
>
>use XML::DOM;
>
>use DBD::Oracle qw(:ora_types);
>
>=20
>
>$ENV{'ORACLE_HOME'} =3D '/mis/TREE/oracle/5prod/8.1.7';
>
>=20
>
>my $dbh =3D DBI->connect('dbi:Oracle:ubmdev.ir.xilinx',
>
> 'xxx',
>
> 'xxxxxxx',
>
> {RaiseError =3D> 1, AutoCommit =3D> 1}) || die=20
>"cannot connect:$DBI::errstr";
>
>=20
>
>print "connected to DB\n";
>
>=20
>
>my $infile =3D "designInfo.xml";
>
>my $dom_parser =3D new XML::DOM::Parser;
>
>my $doc =3D $dom_parser->parsefile($infile);
>
>my $nodes =3D $doc->getElementsByTagName ("designInfo");
>
>=20
>
>my $err1;
>
>my $func1;
>
>eval {
>
> $func1 =3D $dbh->prepare(q{
>
> BEGIN
>
> DESIGN_PKG.checkin_design(:param1, :param2, :param3, :error);
>
> END;
>
> });
>
>=20
>
> $func1->bind_param_inout(":error",\$err1,500);
>
> $func1->bind_param(":param1",$doc->getDocumentElement(), { ora_type=20
>=3D> ORA_CLOB });
>
> $func1->bind_param(":param2",'head-00134');
>
> $func1->bind_param(":param3",'hvenkata');
>
>=20
>
> $func1->execute;
>
> print "DIAGNOSIS: $DBI::lasth : $DBI::lasth->{Type} :
>
>$DBI::lasth->{Statement}\n";
>
>};
>
>=20
>
>if ($@) {
>
> warn "message: $DBI::errstr\n";
>
> warn "message2: " . $func1->errstr() . "\n";
>
> warn "message3: " . $func1->err() . "\n";
>
>}
>
>=20
>
>print "store procedure returns $err1\n";
>
>=20
>
>=20
>
>$dbh->disconnect;
>
>=20
>
>=20
>
>What am I doing wrong?
>
>=20
>
>Hari
>
>
>This electronic message transmission is a PRIVATE communication which=20
>contains information which may be confidential or privileged. The=20
>information is intended to be for the use of the individual or entity=20
>named above. If you are not the intended recipient, please be aware=20
>that any disclosure, copying, distribution or use of the contents of=20
>this information is prohibited. Please notify the sender of the=20
>delivery error by replying to this message, or notify us by telephone=20
>(877-633-2436, ext. 0), and then delete it from your system.
>
>
> =20
>
This electronic message transmission is a PRIVATE communication which =
contains
information which may be confidential or privileged. The information is =
intended=20
to be for the use of the individual or entity named above. If you are =
not the=20
intended recipient, please be aware that any disclosure, copying, =
distribution=20
or use of the contents of this information is prohibited. Please notify =
the
sender of the delivery error by replying to this message, or notify us =
by
telephone (877-633-2436, ext. 0), and then delete it from your system.
RE: inserting XML Document into Oracle database using a stored procedure
am 03.03.2006 00:02:50 von hariharan.venkata-chinnaswamy
I am a newbie in this, so not sure if I am asking the correct question?
If you guys need some specific information let me know.
The problem is I do not know what the problem is. I am not getting any
error message.
I expect the script to insert a xml document into the oracle database.
I have a stored procedure which is expecting a XmlType type parameter.
So in my perl script I create a XML::DOM object and then call the get
DocumentElement method which returns a DocumentElement which I bind with
the bind_param method. See code below.
my $infile =3D "designInfo.xml";
my $dom_parser =3D new XML::DOM::Parser;
my $doc =3D $dom_parser->parsefile($infile);
$func1->bind_param(":param1",$doc->getDocumentElement());
When I tried the above nothing happened.
$func1->bind_param(":param1",$doc->getDocumentElement(), { ora_type =3D>
ORA_CLOB });
When I tried the above line nothing happened
$func1->bind_param(":param1", " foobar ", CLOB);
When I tried this I get the error wrong type being passed.
Thanks
Hari
-----Original Message-----
From: Alexander Foken [mailto:alexander@foken.de]=20
Sent: Thursday, March 02, 2006 2:33 AM
To: hariharan.venkata-chinnaswamy
Cc: dbi-users@perl.org
Subject: Re: inserting XML Document into Oracle database using a stored
procedure
Hariharan Venkata-Chinnaswamy wrote:
>I am trying to insert a XMLType Xmldom.DOMDocument into the Oracle
>database and I am stuck. Thanks in advance for any pointers.
> =20
>
Your post is like going to the doctor and just saying "I'm sick. Cure
me."
What exactly is your problem? What exactly do you expect your script to=20
do? What does it instead? What error messages are returned?
Alexander
--=20
Alexander Foken
mailto:alexander@foken.de http://www.foken.de/alexander/
RE: inserting XML Document into Oracle database using a stored procedure
am 03.03.2006 05:35:39 von Ron.Reidy
My comments in line ...
-----Original Message-----
From: Hariharan Venkata-Chinnaswamy
[mailto:hariharan.venkata-chinnaswamy@xilinx.com]=20
Sent: Thursday, March 02, 2006 4:03 PM
To: Alexander Foken; hariharan.venkata-chinnaswamy
Cc: dbi-users@perl.org
Subject: RE: inserting XML Document into Oracle database using a stored
procedure
I am a newbie in this, so not sure if I am asking the correct question?
If you guys need some specific information let me know.
The problem is I do not know what the problem is. I am not getting any
error message.
I expect the script to insert a xml document into the oracle database.
I have a stored procedure which is expecting a XmlType type parameter.
So in my perl script I create a XML::DOM object and then call the get
DocumentElement method which returns a DocumentElement which I bind with
the bind_param method. See code below.
my $infile =3D "designInfo.xml";
my $dom_parser =3D new XML::DOM::Parser;
[rr] how do you know this worked? Where is the error trapping?
my $doc =3D $dom_parser->parsefile($infile);
[rr] Ditto from above comment.
$func1->bind_param(":param1",$doc->getDocumentElement());
When I tried the above nothing happened.
$func1->bind_param(":param1",$doc->getDocumentElement(), { ora_type =3D>
ORA_CLOB });
When I tried the above line nothing happened
$func1->bind_param(":param1", " foobar ", CLOB);
When I tried this I get the error wrong type being passed.
[rr] Is the scalar " foobar " a Xmldom.DOMDocument type?
If not (and I'll bet it is not), this explains that error.
As I said in my earlier post:
1. You need to put error trapping in the code. No error trapping =3D
confusion - plain and simple.
2. You need to step through the code using the Perl debugger. Since
you are a newbie, read these docs:
Perl debugger:
http://www.ddj.com/documents/s=3D1498/ddj0108pl/
http://debugger.perl.org/
usenet posting guidelines (these specify the perl* groups, but they
should generally be applied to all positing):
http://www.issociate.de/board/goto/905650/Posting_Guidelines _for_comp.la
ng.perl.misc_($Revision:_1.5_$).html
If you don't understand what is wrong, how can anyone on this list
possibly understand either. Use error trapping with eval{} blocks.
Learn and become intimately close to the Perl debugger. Get acquainted
with http://metalink.oracle.com and http://tahiti.oracle.com. If, after
that, you still cannot figure this out and you need help with the
database aspects, post again with your specific issues including, but
not limited to, Oracle and Perl and module versions, and the Oracle
error you are encountering (ORA-nnnnnn), and almost anyone here will be
glad to help you.
rr
Thanks
Hari
-----Original Message-----
From: Alexander Foken [mailto:alexander@foken.de]=20
Sent: Thursday, March 02, 2006 2:33 AM
To: hariharan.venkata-chinnaswamy
Cc: dbi-users@perl.org
Subject: Re: inserting XML Document into Oracle database using a stored
procedure
Hariharan Venkata-Chinnaswamy wrote:
>I am trying to insert a XMLType Xmldom.DOMDocument into the Oracle=20
>database and I am stuck. Thanks in advance for any pointers.
> =20
>
Your post is like going to the doctor and just saying "I'm sick. Cure
me."
What exactly is your problem? What exactly do you expect your script to=20
do? What does it instead? What error messages are returned?
Alexander
--=20
Alexander Foken
mailto:alexander@foken.de http://www.foken.de/alexander/
This electronic message transmission is a PRIVATE communication which =
contains
information which may be confidential or privileged. The information is =
intended=20
to be for the use of the individual or entity named above. If you are =
not the=20
intended recipient, please be aware that any disclosure, copying, =
distribution=20
or use of the contents of this information is prohibited. Please notify =
the
sender of the delivery error by replying to this message, or notify us =
by
telephone (877-633-2436, ext. 0), and then delete it from your system.