pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedstored procedure call is not working with "select procedure()" option
8+ messages / 3 participants
[nested] [flat]
* stored procedure call is not working with "select procedure()" option
@ 2018-02-20 07:13 Abhra Kar <abhra.kar@gmail.com>
0 siblings, 2 replies; 8+ messages in thread
From: Abhra Kar @ 2018-02-20 07:13 UTC (permalink / raw)
To: pgsql-general
Hi ,
I have a stored procedure name "procedure()". Which I am calling
by --
Session sess = (Session)entityManager.getDelegate(); //entityManager is
javax.persistent.EntityManager[ Properly Initialise]
sess.createSQLQuery("select procedure()");
procedure is containing some truncate queries like -- EXECUTE('truncate
table abc');
It's not throwing any exception but not executing the procedure.Using
oracle query -- sess.createSQLQuery("{ call procedure()
}").executeUpdate(); procedure execution is working fine.
What's need to be change here.
Thanks and Regards,
Abhra
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: stored procedure call is not working with "select procedure()" option
@ 2018-02-20 15:16 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Abhra Kar <abhra.kar@gmail.com>
1 sibling, 1 reply; 8+ messages in thread
From: Adrian Klaver @ 2018-02-20 15:16 UTC (permalink / raw)
To: Abhra Kar <abhra.kar@gmail.com>; pgsql-general
On 02/19/2018 11:13 PM, Abhra Kar wrote:
> Hi ,
> I have a stored procedure name "procedure()". Which I am
> calling by --
>
> Session sess = (Session)entityManager.getDelegate(); //entityManager is
> javax.persistent.EntityManager[ Properly Initialise]
> sess.createSQLQuery("select procedure()");
>
> procedure is containing some truncate queries like -- EXECUTE('truncate
> table abc');
>
> It's not throwing any exception but not executing the procedure.Using
> oracle query -- sess.createSQLQuery("{ call procedure()
> }").executeUpdate(); procedure execution is working fine.
>
> What's need to be change here.
More information would help:
1) Postgres version.
2) JDBC driver and version?
3) Any relevant information from the Postgres logs.
The forthcoming Postgres version 11 will have stored procedures, but at
the moment Postgres has only stored functions.
>
> Thanks and Regards,
> Abhra
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: stored procedure call is not working with "select procedure()" option
@ 2018-02-20 15:51 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 8+ messages in thread
From: Adrian Klaver @ 2018-02-20 15:51 UTC (permalink / raw)
To: Abhra Kar <abhra.kar@gmail.com>; +Cc: pgsql-general
On 02/20/2018 07:35 AM, Abhra Kar wrote:
Please also reply to list so more people can see and answer.
Ccing list
>
>
> On Tue, Feb 20, 2018 at 8:46 PM, Adrian Klaver
> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
>
> On 02/19/2018 11:13 PM, Abhra Kar wrote:
>
> Hi ,
> I have a stored procedure name "procedure()". Which I
> am calling by --
>
> Session sess = (Session)entityManager.getDelegate();
> //entityManager is javax.persistent.EntityManager[ Properly
> Initialise]
> sess.createSQLQuery("select procedure()");
>
> procedure is containing some truncate queries like --
> EXECUTE('truncate table abc');
>
> It's not throwing any exception but not executing the
> procedure.Using oracle query -- sess.createSQLQuery("{ call
> procedure() }").executeUpdate(); procedure execution is
> working fine.
>
> What's need to be change here.
>
>
> More information would help:
>
> 1) Postgres version.
>
> 2) JDBC driver and version?
>
> 3) Any relevant information from the Postgres logs.
>
> The forthcoming Postgres version 11 will have stored procedures, but
> at the moment Postgres has only stored functions.
>
>
> Postgres Version -- 9.5
>
> JDBC Driver - org.postgresql.Driver
>
> JDVC driver version and relavant postgres logs didn't get.
>
> Regards,
> Abhra
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: stored procedure call is not working with "select procedure()" option
@ 2018-02-20 16:17 Abhra Kar <abhra.kar@gmail.com>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 8+ messages in thread
From: Abhra Kar @ 2018-02-20 16:17 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general
On Tue, Feb 20, 2018 at 9:21 PM, Adrian Klaver <adrian.klaver@aklaver.com>
wrote:
> On 02/20/2018 07:35 AM, Abhra Kar wrote:
>
> Please also reply to list so more people can see and answer.
> Ccing list
>
>>
>>
>> On Tue, Feb 20, 2018 at 8:46 PM, Adrian Klaver <adrian.klaver@aklaver.com
>> <mailto:adrian.klaver@aklaver.com>> wrote:
>>
>> On 02/19/2018 11:13 PM, Abhra Kar wrote:
>>
>> Hi ,
>> I have a stored procedure name "procedure()". Which I
>> am calling by --
>>
>> Session sess = (Session)entityManager.getDelegate();
>> //entityManager is javax.persistent.EntityManager[ Properly
>> Initialise]
>> sess.createSQLQuery("select procedure()");
>>
>> procedure is containing some truncate queries like --
>> EXECUTE('truncate table abc');
>>
>> It's not throwing any exception but not executing the
>> procedure.Using oracle query -- sess.createSQLQuery("{ call
>> procedure() }").executeUpdate(); procedure execution is
>> working fine.
>>
>> What's need to be change here.
>>
>>
>> More information would help:
>>
>> 1) Postgres version.
>>
>> 2) JDBC driver and version?
>>
>> 3) Any relevant information from the Postgres logs.
>>
>> The forthcoming Postgres version 11 will have stored procedures, but
>> at the moment Postgres has only stored functions.
>>
>>
>
>> Postgres Version -- 9.5
>>
>> JDBC Driver - org.postgresql.Driver
>>
>> JDVC driver version and relavant postgres logs didn't get.
>>
>> Regards,
>> Abhra
>>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
Please provide me the list email.I don't know about it.
Thanks
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: stored procedure call is not working with "select procedure()" option
@ 2018-02-20 16:22 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Abhra Kar <abhra.kar@gmail.com>
0 siblings, 1 reply; 8+ messages in thread
From: Adrian Klaver @ 2018-02-20 16:22 UTC (permalink / raw)
To: Abhra Kar <abhra.kar@gmail.com>; +Cc: pgsql-general
On 02/20/2018 08:17 AM, Abhra Kar wrote:
>
>
> On Tue, Feb 20, 2018 at 9:21 PM, Adrian Klaver
> <adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:
>
>
> Please provide me the list email.I don't know about it.
The list email is the one you used already:
pgsql-general@postgresql.org
I suspect the problem is that when you replied to my first post you did
Reply not Reply All. This picked up my email, but not the list email.
>
> Thanks
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: stored procedure call is not working with "select procedure()" option
@ 2018-02-20 16:29 Abhra Kar <abhra.kar@gmail.com>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 0 replies; 8+ messages in thread
From: Abhra Kar @ 2018-02-20 16:29 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general
On Tue, Feb 20, 2018 at 9:52 PM, Adrian Klaver <adrian.klaver@aklaver.com>
wrote:
> On 02/20/2018 08:17 AM, Abhra Kar wrote:
>
>>
>>
>> On Tue, Feb 20, 2018 at 9:21 PM, Adrian Klaver <adrian.klaver@aklaver.com
>> <mailto:adrian.klaver@aklaver.com>> wrote:
>>
>
>
>>
>> Please provide me the list email.I don't know about it.
>>
>
> The list email is the one you used already:
>
> pgsql-general@postgresql.org
>
> I suspect the problem is that when you replied to my first post you did
> Reply not Reply All. This picked up my email, but not the list email.
>
>
>> Thanks
>>
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
Postgres Version -- 9.5
JDBC Driver - org.postgresql.Driver
JDVC driver version and relavant postgres logs didn't get.
Regards,
Abhra
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: stored procedure call is not working with "select procedure()" option
@ 2018-02-20 17:15 Alban Hertroys <haramrae@gmail.com>
parent: Abhra Kar <abhra.kar@gmail.com>
1 sibling, 1 reply; 8+ messages in thread
From: Alban Hertroys @ 2018-02-20 17:15 UTC (permalink / raw)
To: Abhra Kar <abhra.kar@gmail.com>; +Cc: pgsql-general
> On 20 Feb 2018, at 8:13, Abhra Kar <abhra.kar@gmail.com> wrote:
>
> Hi ,
> I have a stored procedure name "procedure()". Which I am calling by --
>
> Session sess = (Session)entityManager.getDelegate(); //entityManager is javax.persistent.EntityManager[ Properly Initialise]
> sess.createSQLQuery("select procedure()");
…
> It's not throwing any exception but not executing the procedure.Using oracle query -- sess.createSQLQuery("{ call procedure() }").executeUpdate(); procedure execution is working fine.
Seems to me you are forgetting to execute the query, like in your Oracle example. IIRC, calling execute() is how to execute a statement that returns a ResultSet in Java.
Alban Hertroys
--
If you can't see the forest for the trees,
cut the trees and you'll find there is no forest.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: stored procedure call is not working with "select procedure()" option
@ 2018-02-20 17:27 Abhra Kar <abhra.kar@gmail.com>
parent: Alban Hertroys <haramrae@gmail.com>
0 siblings, 0 replies; 8+ messages in thread
From: Abhra Kar @ 2018-02-20 17:27 UTC (permalink / raw)
To: Alban Hertroys <haramrae@gmail.com>; +Cc: pgsql-general
On Tue, Feb 20, 2018 at 10:45 PM, Alban Hertroys <haramrae@gmail.com> wrote:
>
> > On 20 Feb 2018, at 8:13, Abhra Kar <abhra.kar@gmail.com> wrote:
> >
> > Hi ,
> > I have a stored procedure name "procedure()". Which I am
> calling by --
> >
> > Session sess = (Session)entityManager.getDelegate(); //entityManager is
> javax.persistent.EntityManager[ Properly Initialise]
> > sess.createSQLQuery("select procedure()");
>
> …
>
> > It's not throwing any exception but not executing the procedure.Using
> oracle query -- sess.createSQLQuery("{ call procedure()
> }").executeUpdate(); procedure execution is working fine.
>
> Seems to me you are forgetting to execute the query, like in your Oracle
> example. IIRC, calling execute() is how to execute a statement that returns
> a ResultSet in Java.
>
> Alban Hertroys
> --
> If you can't see the forest for the trees,
> cut the trees and you'll find there is no forest.
>
>
So What should be the query ---
sess.createSQLQuery("select procedure()").execute();
Something like this?
Thanks
Abhra
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2018-02-20 17:27 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-02-20 07:13 stored procedure call is not working with "select procedure()" option Abhra Kar <abhra.kar@gmail.com>
2018-02-20 15:16 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-02-20 15:51 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-02-20 16:17 ` Abhra Kar <abhra.kar@gmail.com>
2018-02-20 16:22 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-02-20 16:29 ` Abhra Kar <abhra.kar@gmail.com>
2018-02-20 17:15 ` Alban Hertroys <haramrae@gmail.com>
2018-02-20 17:27 ` Abhra Kar <abhra.kar@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox