473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Please, help me with use db2 function in PreparedStatement

1
Hello everyone!
I am having my own db2 function. Function return table.
FUNCTION GETTAB_MY_INIT(
recid INT)
RETURNS TABLE


In java program i do:

PreparedStatement ps =null;
String s = "SELECT * FROM TABLE(WE.GETTAB_MY_INIT("+user+")) INIT where IDREG = ?;";
ps = preparedst(con, s);
ps.setLong(1,Long.parseLong(pr));


It work.
But I am having problem when i do:
String s = "SELECT * FROM TABLE(WE.GETTAB_MY_INIT(?)) INIT where IDREG = ?;";
ps = preparedst(con, s);
ps.setLong(1,Long.parseLong(pr));
ps.setInt(1,Integer.parseInt(user));


And program generate exception
Exeption e= [IBM][CLI Driver][DB2/NT] SQL0418N

Does any one know how can I solve it? How to dinamic use my parametr in call my function as (?) in this select?

Thank you very much for any help.
May 22 '07 #1
0 1367

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: John Sidney-Woollett | last post by:
Is it possible to call a Postgres stored function (as if it were a procedure), using a PreparedStatement which will receive no return value, instead of having to use a CallableStatement and ignore...
4
by: Dani | last post by:
Hi everyone Description of the problem: Using a PreparedStatement to write down an integer (int) plus a timestamp for testing purposes. When read out again the integer looks very different. We...
5
by: Dov Moryusef | last post by:
Hi to all, I’ve a table with an idendity column : CREATE TABLE USRDB2.MYTABLE ( "ID" INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 0, INCREMENT BY 1, NO CACHE), "CODE"...
6
by: Markus | last post by:
In my Java-application I create an PreparedStatement like this: PreparedStatement v_stmt = dbcon.prepareStatement("SELECT * FROM mytable WHERE UPPER(userID) LIKE UPPER(?)"); v_stmt.setString(1,...
6
by: Jim Steinberger | last post by:
Hey all - my inaugural post, I have a Java web application on Tomcat 5 using pg73jdbc3.jar to connect to PostgreSQL 7.3.4 running on the same server (Red Hat Linux ). I have a Perl...
3
by: info | last post by:
Hallo zusammnen, ich möchte einen VARBINARY-Wert aus einer Tabelle auslesen, diesen in einer Datei speichern und später wieder in eine Tabelle einfügen. Den Wert hole ich mit einem Select und...
1
by: ptkumar | last post by:
Hi All, I am facing one problem, i fetch the record from database using preparedstatement. The resultset contains morethan 300000 records. it got OutOfMemoryError. Plz any body can help me.
6
by: redashley40 | last post by:
This is my first attempt in SQL and PreparedStatement I have add the PreparedStatement and I'm not to sure if I'm doing it correctly. When I do a test run on Choose 1 ,or 2 I get this error. Error...
1
by: manjava | last post by:
Hello, i want to write this requete: in preparedstatement but signe error why can any tell what can write thanks
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.