This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_ extPart_001_01C2431C.4DD75C60
Content-Type: text/plain
I'm using Ruby 1.6.7, Ruby/dbi .15 and I'm trying to call an Oracle stored
proc where the third parameter is of DATE type. I want to pass in the
current date & time by using SYSDATE. If I do the following everything
works as it should.
dbh.do( "BEGIN SOME_PROC( 1, 1, SYSDATE ); END" )
However, if I try to use place holders as below
sql BEGIN SOME_PROC( ?, ?, ? ); END"
dbh.do( sql, 1, 1, SYSDATE )
Oracle returns an error because of the SYSDATE value. Even putting quotes
around SYSDATE doesn't do any good. Using similar code I get the same error
using perl.
Even doing the following works:
Dbh.do( sql, 1, 1, "#{Time.new.strftime( \"%d-%b-%Y\" ) }" ) Does work.
Has anyone else seen this error? Is this an error in DBI or in Oracle? Is
there a way to work around this problem in the current environment?
Bob Berge
------_ extPart_001_01C2431C.4DD75C60
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=ProgId content=Word.Document>
<meta name=Generator content="Microsoft Word 10">
<meta name=Originator content="Microsoft Word 10">
<link rel=File-List href="cid:filelist.xml / 01C242F2.3D4C13B0">
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:DoNotRelyOnCSS/>
</o:OfficeDocumentSettings>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:SpellingState>Clean</w:SpellingState>
<w:GrammarState>Clean</w:GrammarState>
<w:DocumentKind>DocumentEmail</w:DocumentKind>
<w:EnvelopeVis/>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
</w:WordDocument>
</xml><![endif]-->
<style>
<!--
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{mso-style-parent:"";
margin:0in;
margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;
text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;
text-underline:single;}
span.EmailStyle17
{mso-style-type:personal-compose;
mso-style-noshow:yes;
mso-ansi-font-size:10.0pt;
mso-bidi-font-size:10.0pt;
font-family:Arial;
mso-ascii-font-family:Arial;
mso-hansi-font-family:Arial;
mso-bidi-font-family:Arial;
color:windowtext;}
span.SpellE
{mso-style-name:"";
mso-spl-e:yes;}
span.GramE
{mso-style-name:"";
mso-gram-e:yes;}
@page Section1
{size:8.5in 11.0in;
margin:1.0in 1.25in 1.0in 1.25in;
mso-header-margin:.5in;
mso-footer-margin:.5in;
mso-paper-source:0;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";}
</style>
<![endif]-->
</head>
<body lang=EN-US link=blue vlink=purple style='tab-interval:.5in'>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I'm using Ruby 1.6.7, Ruby/<span class=GramE>dbi <span
style='mso-spacerun:yes'> </span>.</span>15 and I'm trying to call
an Oracle stored proc where the third parameter is of DATE type.<span
style='mso-spacerun:yes'> </span>I want to pass in the current date &
time by using SYSDATE.<span style='mso-spacerun:yes'> </span>If I do the
following everything works as it should.<o:p></o:p></span></font></p>
<p class=MsoNormal><span class=GramE><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>dbh.do(</span></font></span><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'> "BEGIN
SOME_PROC( 1, 1, SYSDATE ); END" )<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>However, if I try to use place holders as below<o:p></o:p></span></font></p>
<p class=MsoNormal><span class=GramE><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>sql</span></font></span><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'> = "BEGIN
SOME_PROC( ?, ?, ? ); END"<o:p></o:p></span></font></p>
<p class=MsoNormal><span class=GramE><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>dbh.do(</span></font></span><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'> sql, 1, 1, SYSDATE
) <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Oracle returns an error because of the SYSDATE value. <span
style='mso-spacerun:yes'> </span>Even putting quotes around SYSDATE doesn't
do any good.<span style='mso-spacerun:yes'> </span>Using similar code I
get the same error using perl.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Even doing the following works:<o:p></o:p></span></font></p>
<p class=MsoNormal><span class=GramE><font size=2 face=Arial><span
style='font-size:10.0pt;font-family:Arial'>Dbh.do(</span></font></span><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'> sql, 1, 1, "#{Time.new.strftime(
\"%d-%b-%Y\" ) }" ) <span
style='mso-spacerun:yes'> </span>Does work. <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Has anyone else seen this error?<span
style='mso-spacerun:yes'> </span>Is this an error in DBI or in Oracle?<span
style='mso-spacerun:yes'> </span>Is there a way to work around this
problem in the current environment?<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Bob Berge<o:p></o:p></span></font></p>
</div>
</body>
</html>
------_ extPart_001_01C2431C.4DD75C60--