• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

not all variables bound Error

 
Ranch Hand
Posts: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 41878
909
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 681
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?"
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic