Perl and stored proc question
Hello,
I have used ASP w/ many SQL Server stored procs before and many Oracle stored procs with Java before, but I have yet to embark on calling stored procs from Perl.
My current insert has been like this:
my $dbh = DBIConnect->connect;
my $query1;
$query1 = "INSERT into DEFAULT_PROJECT (NAME, EMAIL, LOCATION,PHONE,MGRNAME,MGREMAIL,"
."PROJNAME,PROJ_LOC,SPON_DEPT,SPON_BUS,PROJ_TYPE)
."values (?,?,?,?,?,?,?,?,?,?,?);"But am looking to replicate an equivalent call to an SP. ok, I've created my multi-table insert in SQL Plus, in PL/SQL, and it's just fine, no errors.
Now I need to make the call.
I've seen a few different things, including the use of DBIx like
DBIx::ProcedureCall qw(sysdate);
I've also seen something like
$csr = $dbh->prepare(q{
BEGIN
DEFPROJ_FORM_INSERTION;
END;
$csr->execute;I'm a bit confused having tried to shake down the CPAN board for a while with little luck.
Anyone out there know how that call might look or go, given the supplied parameters and stored proc. name?
I'd assume I'd be assigning the parameterized values much like I am now.
Can any Perl/Oracle users out there shed any light on this?
Thanks!
alright, so I could not get that to work, but just to validate the insert statement I tried to alter it from an SP to a normal dynamic insert SQL statement.
I get an Oracle error citing
errERROR: Could not execute SQL! Error: ORA-00911: invalid character (DBD ERROR: OCIStmtExecute)
DBI ERROR: ORA-00911: invalid character (DBD ERROR: OCIStmtExecute),Maybe I'm overlooking something simple. Anyone see anything out of place that pertains to the SQL statement?
I think I have input it in a rather manageable, and easy to read block below:
INSERT ALL
INTO DEFAULT_PROJECT_USER
(DEFPROJ_ID,DEFPROJ_ID_LTR,NAME,EMAIL,LOCATION,PHONE,MGRNAME,MGREMAIL,PROJNAME,PROJ_LOC, SPON_DEPT,SPON_BUS,PROJ_TYPE,REG_LEGAL,NETCRED_LOSS, EXPENSE_REDUC_CKB, STRAT_GOALS,AUDIT_COMPL,REV_GEN,CACS,CUSTOMIT,CUST_IMPACT,CALL_MGT,CALL_TRACK,
CITILINK,DESKTOP,DIALER,DRI,ENGINEER,IMAGING,IPDT,MAINFR,MISC_OTHER,MORTSERV,MORTWEB,NON_MORTSERV,ORIG_PLAT,QUAL_MAP,DATAWARE_REPTS,SERV_APP_VDR,SOUTHBEND,WEB_SVCG,PROBLEM_RESOLVE,EXIST_PROC,BUS_OBJECTIVE,
PENDING_PROJ,IMPACT_AREAS,REGULATORY_COMPLY,COMPLY_DEADLINE,SUB_DATE,EXPENSE_REDUCTION_TEXT,PRIORITY_RATING,ADDL_COMMENTS,PROJ_TYPE_OTHER,OTHER_EXPL_IT)
values (defproj_user_seq.nextval,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,to_date(?,'YYYY-MM-DD HH:MI:SS'),SYSDATE,?,?,?,?,?)
INTO DEFAULT_PROJECT_PROJMGR
(DEFPROJ_ID,PROJ_MGR,STATUS,IT_PROJ_TYPE,IT_PROJNUMBER,FUNC_SPECS,FUNC_SPECS_DT,FUNC_SPECS_APPR_DT,BRD_APPROVED,BRD_APPROVED_DT,UAT_STARTDT,UAT_ENDDT,TESTER,RELEASE_DT, TARGETED_RELEASE_DT,BENEFIT_AMT,BENEFIT_CMTS,IT_LEVEL,IT_HOURS,FTES_SAVED,NUM_FTES,PROJQUE1,PROJQUE2,ACTUALCBA)
VALUES (defproj_user_seq.nextval,NULL, NULL, NULL, NULL,NULL, NULL, NULL, NULL,NULL, NULL, NULL,NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,NULL, NULL,NULL,NULL)
INTO DEFAULT_PROJECT_QA
(DEFPROJ_ID,TERM,DEFINITION,BUS_NEED,CUST_IMPACT,CONTACT_NAME,IMPACT,IMPACT_PROCESS,IMPACT_DESC,PROCESS_LOC,PROJ_SCHED,PROJ_JUSTIF,IMPL_DATE,PROJ_EXPL,
PROJ_TYPE,PROJ_JUST_MIT,PROJ_OWNER,PROJ_DATE_STATUS)
VALUES (defproj_user_seq.nextval,NULL, NULL, NULL, NULL,NULL, NULL, NULL, NULL,NULL, NULL, NULL, NULL, NULL,NULL, NULL,NULL,NULL)
SELECT object_name AS DEFPROJ_ID_LTR FROM all_objects where rownum <= 1;what could be leading to an invalid character? The error doesn't show which line.
Thanks, but NEVER MIND...I found it - it's stupid perl! As opposed to a good language (Java).
It balks at the extra semicolon, unlike Java would.
Oh, and why am I using Perl you ask? Other than the "yeah, good question response", it's a long story, but suffice to say they don't allow for our UNIX server to be used with Java, just Perl. : (
I do use Java a good amount here, but sometimes we're bound to crap on another planet where it just isn't an option for the server on which we use Java!
Maybe someday! : )
Message was edited by:
user515689
Similar Messages
-
Hi can anyone help and post a perl example of calling a stored proc from perl?
for example
TYPE CharRECORD IS RECORD (Test TestTable.TestField%TYPE );
TYPE TestCtype IS REF CURSOR Return CharRECORD ;
PROCEDURE SP_TEST (TestC IN OUT TestCtype )
As
Begin
Open TestC for Select TestField from
TestTable;
End;
Where TestField is varchar2 (60)
nullRTFM
perldoc DBD::Oracle has some samples.
Basically what you do is
$sth=$dbh->prepare("begin
PL/SQL code;
END");
$sth->execute();
Regards
Yngvi -
Interbase/Firebird stored proc questions
I have several questions about Interbase/Firebird and the use of stored procedures with JDBC. I am using the FirebirdSQL driver but answers using other drivers (as noted) might be useful as well.
1. Is there any way to call a stored procedure which returns a result set using CallableStatement? If so what does the jdbc string look like and what does the return part of the stored proc look like (presumably do-suspend.)
2. Is there any way to call a stored procedure which returns a value using using CallableStatement? This would be where registerOutParameter() would be used. If so what does the jdbc string look like and what does the stored proc look like?
3. Is there an 'identity' keyword? This would return the value of the last GEN_ID() call.
4. I need to return a unique sequence from a stored proc. I am using the following syntax.
for select tid from Telephone_Type
where tid = :new_tid
into new_tid
do SUSPEND;Is there a simpler way to do this? The value is obviously already in new_tid, I just need some way to return it.For firebird 1.x or Interbase,
There is no need to use a CallableStatement to call a
stored procedure for
a resultset.(doing that , you will get just one row
only!)I know how to do it with a statement. That however was not the point.
The only reason CallableStatement exists is to call stored procedures. And yet the driver, at the time I wrote this, did not work with CallableStatement.
And in all the other drivers I have used CallableStatement is not limited to returning a single row. Perhaps you are thinking of a function. A function returns a type of value, but there are other ways of returning values. And some drivers actually allow for return values, result sets and output parameters all to be returned. -
How to store session id in a variable and use that in a stored proc as input param.
I have a Stored proc in oracle which uses one input param, i want to pass session id to this proc..
I have created a procedure from odi, and called SP from it..placed this ODI proc in a package...bt dnt knw how to pass session id as input param..Hi Andy,
You can create a varaible using substitution API for this,
select <%=odiRef.getSession("SESS_NO")%> from dual
And in the successive call SP pass the variable like #VAR_NAME
Thanks,
G -
ORA-03113 with pool and stored proc
We are experiencing a strange error when calling a stored procedure using a
connection pool (WLS 5.1 SP10, Oracle 8). Everything works fine until the
stored procedure raises a user-defined exception. When the connection is
used again, we get the 03113 error. It appears that the connection is OK
due to the testConnsOnReserve not returning an error, but on the next stored
procedure call, the error happens. The database guys have no answers. Does
anyone have a clue?
Here is an ouput log showing what happens (this was done with a pool with
only one connection):
Got the exception for no BPI Record
getConnection returning
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
7]
Executing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4, :5, :6,
:7, :8); end;
SQLException: SQLState() vendor code(20003)
java.sql.SQLException: ORA-20003: Error at step- Select..,procedure
p_getBPITrckIdForDataTblPk No BPI Record Found...
ORA-01403: no data found
ORA-06512: at "CIFPROC.PKG_UTIL", line 381
ORA-06512: at "CIFPROC.PKG_BPI", line 901
ORA-06512: at line 1
at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
at weblogic.jdbcbase.oci.Statement.executeUpdate(Statement.java,
Compiled Code)
at weblogic.jdbcbase.oci.Statement.execute(Statement.java, Compiled
Code)
at
weblogic.jdbc.pool.PreparedStatement.execute(PreparedStatement.java,
Compiled Code)
at com.juniper.core.comm.JDBCProcHelper.execute(JDBCProcHelper.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.j
ava, Compiled Code)
at
com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProcess
.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:120)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:922)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:886)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java:269)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
Release test worked!
Parsing: select count(*) from dual
Executing: select count(*) from dual
Obtain the connection again
DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
trying
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
7]
Reserve test worked!
Parsing: select count(*) from dual
Executing: select count(*) from dual
getConnection returning
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
7]
Calling stored proc and get comm error
Executing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4, :5, :6,
:7, :8); end;
SQLException: SQLState() vendor code(3113)
java.sql.SQLException: ORA-03113: end-of-file on communication channel
at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
at weblogic.jdbcbase.oci.Statement.executeUpdate(Statement.java,
Compiled Code)
at weblogic.jdbcbase.oci.Statement.execute(Statement.java, Compiled
Code)
at
weblogic.jdbc.pool.PreparedStatement.execute(PreparedStatement.java,
Compiled Code)
at com.juniper.core.comm.JDBCProcHelper.execute(JDBCProcHelper.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.j
ava, Compiled Code)
at
com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProcess
.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:120)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:922)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:886)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java:269)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
Release test fails!
Parsing: select count(*) from dual
SQLException: SQLState() vendor code(3114)
java.sql.SQLException: ORA-03114: not connected to ORACLE
at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
at weblogic.jdbcbase.oci.Statement.execute(Statement.java, Compiled
Code)
at
weblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java,
Compiled Code)
at
weblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
Compiled Code)
at
weblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
Compiled Code)
at
weblogic.jdbc.common.internal.ConnectionPool.release(ConnectionPool.java,
Compiled Code)
at weblogic.jdbcbase.pool.Connection.close(Connection.java, Compiled
Code)
at
com.juniper.core.comm.JDBCProcHelper.closeConnection(JDBCProcHelper.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.closeConnection(BusinessProcess.ja
va, Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.j
ava, Compiled Code)
at
com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProcess
.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:120)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:922)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:886)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java:269)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
Regenerating connection
DriverManager.getDriver("jdbc20:weblogic:oracle:DCIF")
trying
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
7]
trying
driver[className=weblogic.jdbc20.oci.Driver,weblogic.jdbc20.oci.Driver@d63d1
fcf]
getDriver returning
driver[className=weblogic.jdbc20.oci.Driver,weblogic.jdbc20.oci.Driver@d63d1
fcf]
weblogic.jdbcbase.oci.Driver checking: jdbc20:weblogic:oracle:DCIF
Connecting to database using: bmgr/********@DCIF at 0
SQLException: SQLState() vendor code(1012)
java.sql.SQLException: ORA-01012: not logged on - (bmgr/********@DCIF)
at
weblogic.db.oci.OciConnection.getLDAException(OciConnection.java:143)
at weblogic.jdbcbase.oci.Driver.connect(Driver.java:157)
at
weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(Connection
EnvFactory.java:153)
at
weblogic.jdbc.common.internal.ConnectionEnvFactory.refreshResource(Connectio
nEnvFactory.java:207)
at
weblogic.jdbc.common.internal.ConnectionEnv.refresh(ConnectionEnv.java:677)
at
weblogic.common.internal.ResourceAllocator.resetThisOne(ResourceAllocator.ja
va, Compiled Code)
at
weblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
Compiled Code)
at
weblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
Compiled Code)
at
weblogic.jdbc.common.internal.ConnectionPool.release(ConnectionPool.java,
Compiled Code)
at weblogic.jdbcbase.pool.Connection.close(Connection.java, Compiled
Code)
at
com.juniper.core.comm.JDBCProcHelper.closeConnection(JDBCProcHelper.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.closeConnection(BusinessProcess.ja
va, Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.j
ava, Compiled Code)
at
com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProcess
.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:120)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:922)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
l.java:886)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
Manager.java:269)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
at
weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
Code)
weblogic.jdbcbase.oci.Driver checking: jdbc20:weblogic:oracle:DCIF
Connecting to database using: bmgr/********@DCIF at 0
Connected to database at: 160
Parsing: select length(SYSDATE) from dual
Executing: select length(SYSDATE) from dual
Parsing: select VALUE from V$NLS_PARAMETERS where
PARAMETER='NLS_NUMERIC_CHARACTERS'
Executing: select VALUE from V$NLS_PARAMETERS where
PARAMETER='NLS_NUMERIC_CHARACTERS'
Done logging in at: 170
Connection: using OCI API: OCI8
Done with connection regen
DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
trying
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
7]
Parsing: select count(*) from dual
Executing: select count(*) from dual
getConnection returning
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
7]
Parsing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4, :5, :6,
:7, :8); end;
Executing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4, :5, :6,
:7, :8); end;
Parsing: select count(*) from dual
Executing: select count(*) from dual
DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
trying
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
7]
Parsing: select count(*) from dual
Executing: select count(*) from dual
getConnection returning
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
7]
Parsing: begin pkg_BPI.p_getBPIStates(:1, :2); end;
Executing: begin pkg_BPI.p_getBPIStates(:1, :2); end;
Parsing: select count(*) from dual
Executing: select count(*) from dual
DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
trying
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
7]
Parsing: select count(*) from dualWell, this seems to do the trick. We'll keep testing, but the errors have
now disappeared for all instances of this problem.
Thanks for the help!
JDB
"John Bauer" <[email protected]> wrote in message
news:[email protected]...
We'll try this, but it seems to be connection-oriented. If we have a pool
of 5 connections, and an exception happens, only that connection seems tobe
affected. The other connections in the pool work fine, and the proc works
for those connections.
"Joseph Weinstein" <[email protected]> wrote in message
news:[email protected]...
Hi.
The issue is likely related to our caching of PreparedStatements
for performance. If some DBMS failure occurs which could invalidate
a PreparedStatement/cursor such that it could never be re-used,
even after clearParameters) are called etc, then this case might
occur. Please take the attached jar file, and add it to the
weblogic.classpath ahead of the standard weblogic stuff, by
editing your startWebLogic script. This will turn off caching, and
should make the problem go away. Let me know...
Joe
John Bauer wrote:
Here is our configuration.
weblogic.jdbc.connectionPool.CifPool=\
url=jdbc20:weblogic:oracle:QCIF,\
driver=weblogic.jdbc20.oci.Driver,\
loginDelaySecs=1,\
initialCapacity=5,\
maxCapacity=20,\
capacityIncrement=2,\
allowShrinking=true,\
shrinkPeriodMins=30,\
testTable=dual,\
testConnsOnRelease=true,\
props=user=BMGR;password=djr0t$
We are using OCI 8.1.6
"Maria Salzberger" <[email protected]> wrote in message
news:[email protected]...
Hi John,
I have researched about this - but could not find a known issue
which
may
be
related to this.
Which JDBC driver are you using?
Kind Regards
Maria Salzberger
Developer Relations Engineer
BEA Customer Support
John Bauer schrieb in Nachricht <[email protected]>...
We are experiencing a strange error when calling a stored procedure
using
a
connection pool (WLS 5.1 SP10, Oracle 8). Everything works fine
until
the
stored procedure raises a user-defined exception. When the
connection is
used again, we get the 03113 error. It appears that the connectionis OK
due to the testConnsOnReserve not returning an error, but on the
next
stored
procedure call, the error happens. The database guys have no
answers.
Does
anyone have a clue?
Here is an ouput log showing what happens (this was done with a
pool
with
only one connection):
Got the exception for no BPI Record
getConnection returningdriver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
c
7]
Executing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4,
:5,
:6,
:7, :8); end;
SQLException: SQLState() vendor code(20003)
java.sql.SQLException: ORA-20003: Error at step- Select..,procedure
p_getBPITrckIdForDataTblPk No BPI Record Found...
ORA-01403: no data found
ORA-06512: at "CIFPROC.PKG_UTIL", line 381
ORA-06512: at "CIFPROC.PKG_BPI", line 901
ORA-06512: at line 1
at
weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
atweblogic.jdbcbase.oci.Statement.executeUpdate(Statement.java,
Compiled Code)
at weblogic.jdbcbase.oci.Statement.execute(Statement.java,Compiled
Code)
at
weblogic.jdbc.pool.PreparedStatement.execute(PreparedStatement.java,
Compiled Code)
atcom.juniper.core.comm.JDBCProcHelper.execute(JDBCProcHelper.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.
j
ava, Compiled Code)
at
com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProces
s
.java, Compiled Code)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
atjavax.servlet.http.HttpServlet.service(HttpServlet.java:865)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.jav
a
:120)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
p
l.java:922)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
p
l.java:886)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContex
t
Manager.java:269)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
atweblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,Compiled
Code)
Release test worked!
Parsing: select count(*) from dual
Executing: select count(*) from dual
Obtain the connection again
DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
tryingdriver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
c
7]
Reserve test worked!
Parsing: select count(*) from dual
Executing: select count(*) from dual
getConnection returning
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
c
7]
Calling stored proc and get comm error
Executing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4,
:5,
:6,
:7, :8); end;
SQLException: SQLState() vendor code(3113)
java.sql.SQLException: ORA-03113: end-of-file on communication
channel
atweblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
atweblogic.jdbcbase.oci.Statement.executeUpdate(Statement.java,
Compiled Code)
at weblogic.jdbcbase.oci.Statement.execute(Statement.java,Compiled
Code)
at
weblogic.jdbc.pool.PreparedStatement.execute(PreparedStatement.java,
Compiled Code)
atcom.juniper.core.comm.JDBCProcHelper.execute(JDBCProcHelper.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.
j
ava, Compiled Code)
at
com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProces
s
.java, Compiled Code)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
atjavax.servlet.http.HttpServlet.service(HttpServlet.java:865)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.jav
a
:120)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
p
l.java:922)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
p
l.java:886)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContex
t
Manager.java:269)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
atweblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,Compiled
Code)
Release test fails!
Parsing: select count(*) from dual
SQLException: SQLState() vendor code(3114)
java.sql.SQLException: ORA-03114: not connected to ORACLE
atweblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
at weblogic.jdbcbase.oci.Statement.execute(Statement.java,Compiled
Code)
at
weblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java,
Compiled Code)
atweblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
Compiled Code)
atweblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
Compiled Code)
atweblogic.jdbc.common.internal.ConnectionPool.release(ConnectionPool.java,
Compiled Code)
at weblogic.jdbcbase.pool.Connection.close(Connection.java,Compiled
Code)
at
com.juniper.core.comm.JDBCProcHelper.closeConnection(JDBCProcHelper.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.closeConnection(BusinessProcess.j
a
va, Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.
j
ava, Compiled Code)
at
com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProces
s
.java, Compiled Code)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
atjavax.servlet.http.HttpServlet.service(HttpServlet.java:865)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.jav
a
:120)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
p
l.java:922)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
p
l.java:886)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContex
t
Manager.java:269)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
atweblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,Compiled
Code)
Regenerating connection
DriverManager.getDriver("jdbc20:weblogic:oracle:DCIF")
tryingdriver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
c
7]
trying
driver[className=weblogic.jdbc20.oci.Driver,weblogic.jdbc20.oci.Driver@d63d
1
fcf]
getDriver returning
driver[className=weblogic.jdbc20.oci.Driver,weblogic.jdbc20.oci.Driver@d63d
1
fcf]
weblogic.jdbcbase.oci.Driver checking: jdbc20:weblogic:oracle:DCIF
Connecting to database using: bmgr/********@DCIF at 0
SQLException: SQLState() vendor code(1012)
java.sql.SQLException: ORA-01012: not logged on -
(bmgr/********@DCIF)
atweblogic.db.oci.OciConnection.getLDAException(OciConnection.java:143)
at weblogic.jdbcbase.oci.Driver.connect(Driver.java:157)
atweblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(Connectio
n
EnvFactory.java:153)
at
weblogic.jdbc.common.internal.ConnectionEnvFactory.refreshResource(Connecti
o
nEnvFactory.java:207)
at
weblogic.jdbc.common.internal.ConnectionEnv.refresh(ConnectionEnv.java:677)
atweblogic.common.internal.ResourceAllocator.resetThisOne(ResourceAllocator.j
a
va, Compiled Code)
at
weblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
Compiled Code)
atweblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
Compiled Code)
atweblogic.jdbc.common.internal.ConnectionPool.release(ConnectionPool.java,
Compiled Code)
at weblogic.jdbcbase.pool.Connection.close(Connection.java,Compiled
Code)
at
com.juniper.core.comm.JDBCProcHelper.closeConnection(JDBCProcHelper.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.closeConnection(BusinessProcess.j
a
va, Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
Compiled Code)
at
com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.
j
ava, Compiled Code)
at
com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProces
s
.java, Compiled Code)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
atjavax.servlet.http.HttpServlet.service(HttpServlet.java:865)
atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.jav
a
:120)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
p
l.java:922)
at
weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
p
l.java:886)
at
weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContex
t
Manager.java:269)
at
weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
atweblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,Compiled
Code)
weblogic.jdbcbase.oci.Driver checking: jdbc20:weblogic:oracle:DCIF
Connecting to database using: bmgr/********@DCIF at 0
Connected to database at: 160
Parsing: select length(SYSDATE) from dual
Executing: select length(SYSDATE) from dual
Parsing: select VALUE from V$NLS_PARAMETERS where
PARAMETER='NLS_NUMERIC_CHARACTERS'
Executing: select VALUE from V$NLS_PARAMETERS where
PARAMETER='NLS_NUMERIC_CHARACTERS'
Done logging in at: 170
Connection: using OCI API: OCI8
Done with connection regen
DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
tryingdriver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
c
7]
Parsing: select count(*) from dual
Executing: select count(*) from dual
getConnection returning
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
c
7]
Parsing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4,
:5,
:6,
:7, :8); end;
Executing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4,:5,
:6,
:7, :8); end;
Parsing: select count(*) from dual
Executing: select count(*) from dual
DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
trying
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
c
7]
Parsing: select count(*) from dual
Executing: select count(*) from dual
getConnection returning
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
c
7]
Parsing: begin pkg_BPI.p_getBPIStates(:1, :2); end;
Executing: begin pkg_BPI.p_getBPIStates(:1, :2); end;
Parsing: select count(*) from dual
Executing: select count(*) from dual
DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
trying
driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
c
7]
Parsing: select count(*) from dual
B.E.A. is now hiring! (12/14/01) If interested send a resume to
[email protected]
DIRECTOR OF PRODUCT PLANS AND STRATEGY San Francisco,
CA
E-SALES BUSINESS DEVELOPMENT REPRESENTATIVE Dallas, TX
SOFTWARE ENGINEER (DBA) Liberty Corner,NJ
SENIOR WEB DEVELOPER San Jose, CA
SOFTWARE ENGINEER (ALL LEVELS), CARY, NORTHCAROLINA San Jose, CA
SR. PRODUCT MANAGER Bellevue, WA
SR. WEB DESIGNER San Jose, CA
Channel Marketing Manager - EMEA Region London, GBR
DIRECTOR OF MARKETING STRATEGY, APPLICATION SERVERS San Jose, CA
SENIOR SOFTWARE ENGINEER (PLATFORM) San Jose, CA
E-COMMERCE INTEGRATION ARCHITECT San Jose, CA
QUALITY ASSURANCE ENGINEER Redmond, WA
Services Development Manager (Business Development Manager - Services)Paris, FRA; Munich, DEU
SENIOR SOFTWARE ENGINEER (PLATFORM) Redmond, WA
E-Marketing Programs Specialist EMEA London, GBR
BUSINESS DEVELOPMENT DIRECTOR - E COMMERCE INTEGRATION San Jose, CA
MANAGER, E-SALES Plano, TX -
Migrate tables and stored proc from SQLServer 2005 Express to Oracle10G
How to migrate tables and stored procedures from SQLServer 2005 Express to Oracle10G using SQLDeveloper? thank you very much
Using Oracle SQL Developer Migration Workbench
http://www.oracle.com/technology/tech/migration/workbench/index_sqldev_omwb.html -
CF to MySQL stored proc question
looking at multiple examples of ColdFusion to MySql procedure
calls and I think code example 1 should return a value in the OUT
param. I get [empty string] displayed.
Code example 2 which changes the ColdFusion code by adding
<cfprocresult
name="searchResults">
and returning
<cfdump var="#searchResults#" label="Search Results">
works fine. I have about 10 examples including from Adobe
coded as example 1. Please would somebody explain :-)
TIA,
MicWell, when I use the Stored Procedures, I simply access the
cfprocresult's RecordCount to see if anything was returned. The
specifics (from example 2 that you had) is:
<cfif searchResults.RecordCount GT 0>
do the "yup he's a real guy"
<cfelse>
do your failure routine
</cfif>
You should get an error message, for instance, if you tried
to do a cfoutput on that variable, that you are trying to access a
complex data type (or something like that). So I would try to
access the RecordCount as 0 or not 0 if you are simply looking to
see if it found SOMETHING.
- Mike -
Table Trigger and Stored Procedure Question
I'm rusty with triggers/procedures and have a quick question.
If a rollback occurs within a procedure containing a raise_applciation_error called from a table insert trigger, will this prevent the insert on the table from occuring?
I want the transaction to be occur on the table even though an exception is raised within the called procedure.If the trigger is an "after insert" and the procedure called by the trigger raises an error, will the row still be inserted?
SQL> create table t (n number);
Table created.
SQL> create or replace
2 procedure p as
3 begin
4 raise_application_error(-20001,'Something bad happened');
5 end;
6 /
Procedure created.
SQL> create or replace
2 trigger t_trig
3 after insert
4 on t
5 begin
6 p;
7 end;
8 /
Trigger created.
SQL> insert into t values (42);
insert into t values (42)
ERROR at line 1:
ORA-20001: Something bad happened
ORA-06512: at "SELSE.P", line 3
ORA-06512: at "SELSE.T_TRIG", line 2
ORA-04088: error during execution of trigger 'SELSE.T_TRIG'
SQL> select * from t;
no rows selected -
Getting error while invoking relational physical DS for sybase stored proc
*com.bea.dsp.das.exception.DASException: com.bea.dsp.wrappers.rdb.exceptions.RDBWrapperException: {bea-err}RDBW0004: Error executing SQL query: [BEA][Sybase JDBC Driver][Sybase]SELECT INTO command not allowed within multi-statement transaction+.*
I have created a physical DS function using "relational" in the wizard and connecting to sybase ASE stored procedure that is in unchained mode. I had configured the JDBC pool using BEA sybase non-XA 12.x driver.
When i run the physical DS (or logical DS), i get the above error. The sybase srever(and stored proc) is hosted by an external system and right now i do not have access/contacts to change anything.
After hours spent googling, it appears that the fix may possibly be setting "set chained off" before calling the stored proc. To achieve that, i tried the below two methods but nothing seems to work:
- In the JDBC URL, set property via ?chained=off (also tried false instead of "off")
- In Admin console/JDBC connection pool configuration/initSQL tried "SQL SET CHAINED OFF" and "SET CHAINED OFF"
My ODSI version is 10gR3
Oracle Workshop for WebLogic
Version: 10.3
Build id: 1137967
I tried using java physical DS and get the same error. I wrote a test stored proc in my local PC sybase ASE and it runs fine. But i connected as "sa".
I would like to exhaust all possible options from my side before making the long process of getting something changed in the external sybase DB like setting the proc mode to "anymode".
Please help.
Thank you.mikereiche wrote:
Did the test stored proc use "SELECT INTO"?Yes. But it did not do much(code below)
>
Was the test stored proc tagged the same as the one that fails (chained/unchained?)Yes. "sp_procxmode" confirms that the test stored proc is in "unchained" transaction mode.
>
Can you get jdbc code that successfully calls the stored proc using the datasource?Yes, my colleague was trying the jdbc code and i was trying in the workshop with relational. She has left for the day so will post tomorrow. Please note that this is only for the test stored proc. The java jdbc also gets the same error for the "real" stored proc.
>
BTW - if you used "SET CHAINED OFF" as initSql, unless you have a table named SET, the sql will fail and the datasource will not be created. So that casts some doubt on whether the other setting "SQL SET CHAINED OFF" was applied.
Also - the connections are reset to default when they are returned to the connection pool, so I think "SQL SET CHAINED OFF" should be used as the "Test Table Name" and Test On Reserve should be checked.Tried it now, but it does not work. I'm getting the same error.
test stored proc:
create procedure dbo.getCustomerMulti @cid_inp varchar(40)
as
begin
select dbo.Customer.FirstName, dbo.Customer.cid, dbo.Customer.LastName, dbo.Customer.DateCreated, dbo.Customer.id into #temp from dbo.Customer
select dbo.Customer.FirstName, dbo.Customer.cid, dbo.Customer.LastName, dbo.Customer.DateCreated, dbo.Customer.id from dbo.Customer where cid LIKE @cid_inp + '%'
end
Thank you. -
MS SQL Server 7 - Performance of Prepared Statements and Stored Procedures
Hello All,
Our team is currently tuning an application running on WL 5.1 SP 10 with a MS
SQL Server 7 DB that it accesses via the WebLogic jConnect drivers. The application
uses Prepared Statements for all types of database operations (selects, updates,
inserts, etc.) and we have noticed that a great deal of the DB host's resources
are consumed by the parsing of these statements. Our thought was to convert many
of these Prepared Statements to Stored Procedures with the idea that the parsing
overhead would be eliminated. In spite of all this, I have read that because
of the way that the jConnect drivers are implemented for MS SQL Server, Prepared
Statments are actually SLOWER than straight SQL because of the way that parameter
values are converted. Does this also apply to Stored Procedures??? If anyone
can give me an answer, it would be greatly appreciated.
Thanks in advance!Joseph Weinstein <[email protected]> wrote:
>
>
Matt wrote:
Hello All,
Our team is currently tuning an application running on WL 5.1 SP 10with a MS
SQL Server 7 DB that it accesses via the WebLogic jConnect drivers.The application
uses Prepared Statements for all types of database operations (selects,updates,
inserts, etc.) and we have noticed that a great deal of the DB host'sresources
are consumed by the parsing of these statements. Our thought was toconvert many
of these Prepared Statements to Stored Procedures with the idea thatthe parsing
overhead would be eliminated. In spite of all this, I have read thatbecause
of the way that the jConnect drivers are implemented for MS SQL Server,Prepared
Statments are actually SLOWER than straight SQL because of the waythat parameter
values are converted. Does this also apply to Stored Procedures???If anyone
can give me an answer, it would be greatly appreciated.
Thanks in advance!Hi. Stored procedures may help, but you can also try MS's new free type-4
driver,
which does use DBMS optimizations to make PreparedStatements run faster.
Joe
Thanks Joe! I also wanted to know if setting the statement cache (assuming that
this feature is available in WL 5.1 SP 10) will give a boost for both Prepared Statements
and stored procs called via Callable Statements. Pretty much all of the Prepared
Statements that we are replacing are executed from entity bean transactions.
Thanks again -
Stored Proc Migration question
In sql server I have what is basically a select statement (multiple records) that is returned from a stored proc and as I understand it Oracle doesn't allow you do this in the same fashion.
Instead a cursor has to be used (from what i understand?, although I am not 100% sure)
so my question is this; Use of cursors in MS SQL Sever / Sybase can be resource intensive and slow. - my understanding of cursors in SQL server\ sybase is that you should really use them unless you have to.
Is this the case in Oracle, or is it totally different?
should I be looking at a different way of reproducing the data - i.e. using a procedure to create that data into a table then using a view to return the records.
many thanksAny SQL statement that returns records is a cursor, whether in Oracle od SQL Server or Sybase. There may be a larger difference in SQL Server performance between explicit cursors (i.e. those formally declared) and implicit cursors (i.e. just select) than there is in Oracle, but they are all still cursors.
The only way to retunr a result set to a calling program from a stored proc in Oracle is to use a cursor. Cursors, in themselves, are not any more resource intensive than the underlying sql statement. What tends to be resource intensive in Oracle is the row by row processing that people usually do with th cursors they fetch.
In Oracle, you would generally do something like this to return a cursor to another program.
PROCEDURE p (p_id IN NUMBER, p_cur OUT SYS_REFCURSOR)
BEGIN
OPEN p_cur FOR SELECT * FROM t WHERE id = p_id;
END;Then call it like:
DECLARE
l_cur SYS_REFCURSOR;
variables or a record to receive the fields
BEGIN
p(1, l_cur);
LOOP
FETCH l_cur INTO variables or record
EXIT WHEN l_cur%NOTFOUND;
<processing>
END LOOP;
END;The exact syntax to declare the cursor and call the stored proc will depend on the language of the calling program.
You could also do P as a function returning a sys_refcursor.
HTH
John -
How to migrate stored procs accessing columns "LEFT" and "RIGHT"
Hello!
I have to migrate a SYBASE11-Database to Oracle 8.1.7.
How can I migrate Stored Procs that access tables that contain columns 'LEFT' and 'RIGHT'?
OMWB reports a parse error "encountered: ,". If ommit the words 'left' or 'right' or if I write 'left()' or 'right()', it works. But I have to use these columns and we cannot change the database model.
It doesn't work with quoted column names like this: "LEFT" or "RIGHT".
I use OWMB 1.3.1.0.0. Anybody any ideas? Thanks in advance.
Yours, Heiko KaschubeThis is a simple matter to fix.
As the words LEFT and RIGHT are treated as reserved words by the stored procedure parser, they cannot be used successfully as column names within Oracle PL/SQL.
In order to get the stored procedure to parse, you can append an underscore to all references to LEFT and RIGHT e.g.
left_
then right click on the stored procedure name and select 'parse procedure' from the drop-down menu. The procedure will now parse and the generated PL/SQL can be viewed within the Oracle model menu tab.
It will now be necessary to remove all the underscores previously appended to the words 'left' and 'right' from the PL/SQL version of the stored procedure in question. Again, this can be done within the Migration Workbench.
Hope this helps. -
Oracle Packages/Stored Proc and VB
Hello,
I have a new assignment that I have to start at the client site ASAP. The client wants all the Sql in Oracle Stored Procs/Packages and VB being the front end. I am used to embedding my sql statements in my VB apps and connecting through ADO's but the client does not want embedded sql statements. My question is this, when I make a connection, in accessing the cursor, do I have to loop through the cursor and store the data in an ADO recordset or do I have to connect to the cursor and manipulate the data directly? Please give example.
The DB is Oracle 9i
ThanksYou are doing the right thing, there are examples of how to process result sets from stored procedures, including ASP/ADO at Asktom here
-
Replacing null values in optional prompts and passing to stored proc
Hi,
I want to create a stored procedure with OPTIONAL prompts. When user does not pass a value for that parameter, I want to set the value for that parameter by selecting from a column in table then I WANT to use that paramvalue in sql within cursor of stored proc. How do I do that?
In short, I want to do the following Here is the psuedocode:
Create or replace procedure test (param IN varchar2 DEFAULT NULL)
As
var_param varchar(20);
select param into var_param from dual;
If param is null then select custid from table1 else var_param
OPen ref_cursor for
Select xyz from table2
where fyy = var_para
Can someone let me know the syntax on how to do this in stored proc?
Regards,
hena
Edited by: 904385 on Dec 25, 2011 7:04 AMHi,
Merry Christmas, and welcome to the forum!
Here's one way to do what you requested:
CREATE OR REPLACE PROCEDURE test
( param IN VARCHAR2 DEFAULT NULL
AS
ref_cursor SYS_REFCURSOR;
var_param VARCHAR2 (20) := param;
BEGIN
IF var_param IS NULL
THEN
SELECT custid
INTO var_param
FROM table1
-- WHERE ... -- Unless table1 has only 1 row
END IF;
OPEN ref_cursor
FOR SELECT xyz
FROM table2
WHERE fyy = var_param;
END test;Whatever you're trying to do, this is probably niot the simplest or most efficient way to do it. -
Hi All,
Fairly new at this, and a little confused with dates and date formats.
I run the following:
alter session set nls_date_format = 'dd/mm/yyyy'
If I select sysdate from dual:
02/11/2008 --> so this is correct.
Now what I can't figure out is why I get different results if I use an sql statement VS a stored proc.
If I run this sql update statement:
UPDATE MAPPER.CONV_CNSTNTS
SET CN_VALUE = TO_DATE('12/05/2007','MM/DD/YYYY')
WHERE CN_TYPE = 'CONV'
AND CN_REFRNCE = 'CONVDATE';
When I select this data it shows: 12/05/2007
This works perfect.
Now if I take the exact same statement and put it in a stored proc i get a different result:
create or replace procedure proc_test_date as
begin
UPDATE MAPPER.CONV_CNSTNTS
SET CN_VALUE = TO_DATE('12/05/2007','MM/DD/YYYY')
WHERE CN_TYPE = 'CONV'
AND CN_REFRNCE = 'CONVDATE';
COMMIT;
end;
When I select this data it shows: 05-DEC-07
Why is there a difference here? Is there a difference in the NLS settings that are used when you run an sql statement vs a stored proc?
Thanks for your help in advance.Thank you for the quick response.
Glad I am on the right track ... NLS settings are painful :)
So I ran: alter session set nls_date_format = 'Month DD, YYYY';
Ran my proc and then the select.
Still the date shows up as: 05-DEC-07
I looked at the nls_parameters
select * from v$nls_parameters
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT Month DD, YYYY
NLS_DATE_LANGUAGE ENGLISH
I am using Oracle SQL Developer. I made sure these were set as well:
Tool >> Preferences >> Database >> NLS Parameters
Date Format --> MM/DD/YYYY
Seems that I am missing something ...
Maybe you are looking for
-
Web Service in Document Template Designer not showing
Hi, I'm trying to create a new document template but the dropdown list is not showing any results even though we have web services that are active and productive. If I enter the name manually I am getting a "Please enter a valid Service definition na
-
Hi ABAP Gurus, we want to have a <b>BDC</b> for <b>PAYMENT LINKING.</b> <b>Business scenario :</b> Customer makes an Incoming Payment . The Invoices are linked to this incoming Payments. Currently in R/3 we are using TCODE : F-28 for
-
Printer server error when attempting to print wirelessly
Hope someone can assist me. I get the following error when I use system diagnostics when I attempt to print through the airport extreme wireless USB printer port, "Cannot connect to sever. Network diagnostics was able to connect to the internet, but
-
Problem woth storing data in binary.
Hi, I have some data which I am storing in binary and when I read it back in, I get different data than that which was stored...I was wondering if anyone could help me out as to what I have done wrong, Below are the 2 Vi's I am using to test this: t
-
Screen went black during migration from time machine backup
Just did a clean install of Mavericks on my wife's 3-year old MacBook Air. I erased the hard disk first from the Recovery drive. Then did the Maverics install. All went well. Then I started a Time Machine migration from a back up I had on a Toshiba