Re: [SQL] Calling plSQL functions

2001-04-13 Thread Lonnie Cumberland
Thanks for the code snippet Josh, I'll give this method a try as it is only for a simple listing and will not have to do too many things special. Cheers Lonnie --- Josh Berkus <[EMAIL PROTECTED]> wrote: > Lonnie, Tom: > > Here's a somewhat complicated example of what Tom's talking about from >

Re: [SQL] Calling plSQL functions

2001-04-13 Thread Josh Berkus
Lonnie, Tom: Here's a somewhat complicated example of what Tom's talking about from my own programs. HOWEVER, you should use this kind of structure sparingly, if at all. SQL is a declarative language, rather than a procedural one. For updates to groups of records, you should put the updates

Re: [SQL] Calling plSQL functions

2001-04-13 Thread Tom Lane
Lonnie Cumberland <[EMAIL PROTECTED]> writes: > Actually I have the need at different places in my functions to > sometimes work on the list items returned from a query and also have > the need to just work on the first result returned by a query. SELECT ... LIMIT 1 will serve the second need. F

Re: [SQL] Calling plSQL functions

2001-04-13 Thread Lonnie Cumberland
Thanks for the info Tom, I found that same solution just after I had sent this message to the mailing list. I set up a RECORD variable that should receive the results, but the documentation is unclear as to if the variable will receive ALL of the results from the query of just the first result f

Re: [SQL] Calling plSQL functions

2001-04-13 Thread Tom Lane
Lonnie Cumberland <[EMAIL PROTECTED]> writes: > I have then created a PL/pgSQL function called "register_user()" in a file > called register.sql > create function register_user(text,text,text,text,text,text,text,text,text) > [snip] > begin > -- Look to see if the login is already taken >

Re: [SQL] Calling plSQL functions

2001-04-12 Thread Josh Berkus
Lonnie, > Sorry for the bad terminology as I will try to get it corrected as I > have a > better learning of how to use postgresql properly. No problem. I just wanted to clarify your question; I didn't understand it. > create function register_user(text,text,text,text,text,text,text,text,tex

Re: [SQL] Calling plSQL functions

2001-04-12 Thread Lonnie Cumberland
I solved the problem Josh. It had to do with the "select ..." statement in the function and also I needed to include a "record" variable so the the "select into " could act upon. Thanks for the help anyway. Cheers, Lonnie --- Josh Berkus <[EMAIL PROTECTED]> wrote: > Lonnie, > > It may be that

Re: [SQL] Calling plSQL functions

2001-04-12 Thread Lonnie Cumberland
Hello Josh, Sorry for the bad terminology as I will try to get it corrected as I have a better learning of how to use postgresql properly. I will simply show you what I have done which should clarify things better. I have created a table "user_info" in a database "trdata" with a file called tab

Re: [SQL] Calling plSQL functions

2001-04-11 Thread Josh Berkus
Lonnie, It may be that you have not linked the PL/pgSQL language in Postgres. It may be that you are putting a SELECT statement inside your function. It is hard to tell, becuase I am unclear on the problem youa re having, exactly. Here's some terminology to help clarify: PL/pgSQL is the exten

[SQL] Calling plSQL functions

2001-04-11 Thread Lonnie Cumberland
Hello All, I have created a plSQL function with the "create function ..." which seems to be ok and is just very simple. I then wanted to load the function by: psql -f test.sql -d trdata which loads my function fine. the problem is that I do not know how to call this function from the PLSQL in