Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

not all variables bound Error

 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting the not all variables bound error message. Reserach on the internet states that this error is triggered by not supplying the right number of varaibles to the place holders.
But I have:
The store procedure is as follows:
CREATE OR REPLACE procedure INSERTINTOTIMESHEET(cName IN varchar2,
pName IN varchar2,
charge IN varchar2,
inv IN varchar2,
we IN DATE)
IS
BEGIN
DECLARE
tID NUMBER;
cID NUMBER;
pID NUMBER;
cursor tscursor IS select timeSheetId from TIMESHEET;
BEGIN
select CUSTOMERID into cID from CUSTOMER where CUSTOMERNAME=cName;
select PROJId into pID from PROJECT where PROJNAME=pName;
OPEN tscursor;
FETCH tscursor INTO tID;
dbms_output.put_line('SQL%ROWCOUNT '|| tscursor%ROWCOUNT);
IF tscursor%ROWCOUNT = 0 THEN
dbms_output.put_line('0 rows returned');
INSERT INTO TIMESHEET values (100,cID,pID,charge,0,inv,we);
ELSE
dbms_output.put_line('1 row returned');
select max(timeSheetId) into tID from TIMESHEET;
tID := tID+1;
INSERT INTO TIMESHEET values (tID,cID,pID,charge,0,inv,we);
END IF;

END;
END;
This procedure works by it self, fails when I call it from a JSP:
String Customer = request.getParameter("Customer");
String Project = request.getParameter("Project");
String Chargeble = request.getParameter("Chargeble");
String Invoiced = request.getParameter("Invoiced");
String weekEnding = request.getParameter("Week Ending");
try
{
CallableStatement cstmt =
conn.prepareCall("{call INSERTINTOTIMESHEET(?,?,?,?,?)}");
cstmt.executeQuery();
cstmt.setString(1, Customer);
cstmt.setString(2, Project);
cstmt.setString(3, Chargeble);
cstmt.setString(4, Invoiced);
cstmt.setString(5, weekEnding);
}
catch(SQLException se)
{
System.out.println(se);
}
Thanks for any help Tony.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony,
It's probably happening where you are trying to convert a java string to an oracle date. Can you use a java.util.Date when setting the parameter? (This is cleaner anyway since you don't have to worry about database data formats.)
 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree but I had a nightmare of a time tring to get Date to work in my Java application. The Date comes in as a string, I then tried to convert it into a date using DateFormat class, but although it supposed to return a Java.util.Date the complier complaine that it was expecting a Java.SQL.Date.
When I used Java.SQL.Date the system just crashed.
Tony
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65220
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To convert a java.util.Date, let's say in variable xyz to a java.sql.Date (not java.SQL.Date):

new java.sql.Date( xyz.getTime() )

What do you mean by "made the system crash?"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic