| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.oracle -> SP call does not work
Hello.
In this call from a Java prog to a Oracle SP I am trying to pass along some varchars and a cursor, but apperently the syntax of the call to the stor proc is incorrect. What am I doing wrong?
Please help.
Thanks,
Eugene.
/****************************** PL\SQL Stored Proc. *************************/
( PV_dm_c IN VARCHAR2, PV_dm_x IN VARCHAR2, pv_flag IN VARCHAR2,
V_LIKE_STR := PV_dm_x || '%';
OPEN CURR FOR
SELECT dm_c, dm_x
FROM dm_row_ss
WHERE dm_c = PV_dm_c
AND dm_x LIKE V_LIKE_STR;
V_LIKE_STR := PV_dm_x;
OPEN CURR FOR
SELECT dm_c, dm_x
FROM dm_row_ss
WHERE dm_c = PV_dm_c
AND dm_x = V_LIKE_STR;
/***************************************************************************
/*************************** Java Appl***************************************/ import java.sql.*; import java.sql.DriverManager; import java.sql.Connection; import java.sql.Types; import java.sql.CallableStatement;
public class callsp
{
public static void getData() {
try
{
final String driverClass = "oracle.jdbc.driver.OracleDriver";
final String connectionURL =
"jdbc:oracle:thin:@hostname.com:1521:INSTANCE002";
final String userID = "user";
final String userPassword = "passwd";
Connection con = null;
String var1 = "PWS";
System.out.print("---------------------------------------" + "\n");
System.out.print(" Connecting to -> " + connectionURL + "\n");
System.out.print("---------------------------------------" + "\n");
con = DriverManager.getConnection(connectionURL, userID, userPassword);
CallableStatement cs = con.prepareCall("{call
schtru.sp_get_all_descr ?, ?, ?, ?}");
cs.setString(1, var1);
cs.setString(2, var2);
cs.setString(3, var2);
cs.registerOutParameter(1, Types.VARCHAR);
cs.registerOutParameter(2, Types.VARCHAR);
cs.registerOutParameter(3, Types.VARCHAR);
cs.registerOutParameter(4, OracleTypes.CURSOR);
cs.execute();
while (rs.next()) {
String s = rs.getString(1);
System.out.println(s + " pounds of " + s + " sold to date.");
}
/***************************************************************************
Exception is java.sql.SQLException: ORA-06550: line 1, column 41: PLS-00103: Encountered the symbol "" when expecting one of the following:
:= . ( @ % ;
The symbol ":=" was substituted for "" to continue.
Received on Fri May 21 2004 - 15:20:09 CDT
![]() |
![]() |