logo       

Sponsor
FREE Network Mapping Tool for Microsoft® Office Visio® Professional 2007
Don't map your network by hand - let LANsurveyor Exx press for Microsoft Visio Professional 2007 automatically create network diagrams for you!

Re: Problem about executeUpdate and stored procedure that: msg#00068

db.postgresql.jdbc

Subject: Re: Problem about executeUpdate and stored procedure that

Barry Lind,
function:
create function testfunc() returns void language sql as 'update table1
set col1=0';
Test.java:
...
CallableStatement stmt = null;
try
{
stmt = conn.prepareCall("{call testfunc()}");
stmt.executeUpdate();
}
catch(Exception e)
{
System.out.println(e.toString());
}
...
output:
java.sql.SQLException: ERROR: Unknown kind of return type specified
for function testfunc

I checked the jdbc code, and find this in
AbstractJdbc1Statement::modifyJdbcCall(string):
if (connection.haveMinimumServerVersion("7.3")) {
l_sql = "select * from " + l_sql + " as " +
RESULT_ALIAS + ";";
} else {
l_sql = "select " + l_sql + " as " + RESULT_ALIAS + ";";
}
I changed "7.3" to "7.4" here. And then the error became : A result was
returned when none was expected.

>Han,
>
>Could you send a more complete test case, that I could compile and run?
>
>thanks,
>--Barry
>
>
>Han wrote:
>> pgsql-jdbc
>>
>> When using executeUpdate with {call func_name(?,?,?)}, there's an error
>> saying that no result should be returned. But the value is updated
>> successfully in the database by the function.
>> I know that it's because {call func_name(?,?,?)} be transfered to
>> "select func_name(...) as result" and this sql returns a row. But I do need
>> to call a function that returns no result, but do some updates. I defined
>> the function as "create function ... returns void as'...'". But it still
>> returns a row contains one field with null value.
>> I don't want to use executeQuery. Is there anyother way to do this? Or
>> should the jdbc executeUpdate should be fixed?
>> Thanks!
>>
>>         
>>
>>
>>         Han
>>         zhouhanok@xxxxxxxxxxxx
>>           2003-05-16
>>
>>
>>
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 2: you can get off all lists at once with the unregister command
>> (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)
>>
>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>http://www.postgresql.org/docs/faqs/FAQ.html

Regards!


        Han
        zhouhanok@xxxxxxxxxxxx
          2003-05-19





---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@xxxxxxxxxxxxxx






Only community members can participate in forum threads. You must Register or log in to contribute.

<Prev in Thread] Current Thread [Next in Thread>
Sponsor
FREE Network Mapping Tool for Microsoft® OfficeVisio Professional 2007
Don't map your network by hand - let LANsurveyor Express for Microsoft Visio Professional 2007
automatically create network diagrams for you!
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | sitemap | advertise | OSDir is an inevitable website. super tiny logo