pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
using sql on v7.4 server to feed stored procedure
2+ messages / 2 participants
[nested] [flat]

* using sql on v7.4 server to feed stored procedure
@ 2007-03-30 19:19 Brian Jarrett <digimotif@gmail.com>
  2007-03-30 20:14 ` Re: using sql on v7.4 server to feed stored procedure Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Brian Jarrett @ 2007-03-30 19:19 UTC (permalink / raw)
  To: pgsql-sql

I just found out that I posted this to the wrong list before, so if
this ends up as a cross-post, I'm sorry.

I've created some sql scripts to update a database in version 8.x and
now I'm trying to get them to run on servers using v7.4

The following statement works on 8.x servers, but not on 7.4 and I
can't figure out how to get it to operate in the earlier version:

select calc_cum_gpa_mp(marking_period_id::TEXT)
from (select distinct marking_period_id from student_mp_stats) as
sms1;

I get the error:

ERROR: syntax error at or near "("
SQL state: 42601
Context: compile of PL/pgSQL function "calc_cum_gpa_mp" near line 8

Can anyone point me in the right direction?  I've searched everywhere
for how to use stored procedures in sql queries, and haven't found how
to use the subquery to feed values to the stored procedure.  It almost
looks like I'd need to create another plpgsql function with a loop to
do the same thing.

Brian



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: using sql on v7.4 server to feed stored procedure
  2007-03-30 19:19 using sql on v7.4 server to feed stored procedure Brian Jarrett <digimotif@gmail.com>
@ 2007-03-30 20:14 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2007-03-30 20:14 UTC (permalink / raw)
  To: Brian Jarrett <digimotif@gmail.com>; +Cc: pgsql-sql

"Brian Jarrett" <digimotif@gmail.com> writes:
> The following statement works on 8.x servers, but not on 7.4 and I
> can't figure out how to get it to operate in the earlier version:

> select calc_cum_gpa_mp(marking_period_id::TEXT)
> from (select distinct marking_period_id from student_mp_stats) as
> sms1;

> I get the error:

> ERROR: syntax error at or near "("
> SQL state: 42601
> Context: compile of PL/pgSQL function "calc_cum_gpa_mp" near line 8

> Can anyone point me in the right direction?

You need to look into the referenced plpgsql function; this statement in
itself is not at fault.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-03-30 20:14 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-03-30 19:19 using sql on v7.4 server to feed stored procedure Brian Jarrett <digimotif@gmail.com>
2007-03-30 20:14 ` Tom Lane <tgl@sss.pgh.pa.us>

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