Unix Technical Forum

query and stored procedures

This is a discussion on query and stored procedures within the pgsql Admins forums, part of the PostgreSQL category; --> I'm so totally new to postgresql that I'm not sure how to word this. I want to create a ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-10-2008, 01:15 AM
David Bear
 
Posts: n/a
Default query and stored procedures

I'm so totally new to postgresql that I'm not sure how to word this.

I want to create a query, that does two things

1) take input in the form of a string of numbers, and test if
a) is ssn
b) or internal id

if the string is an ssn, make a second query to another data base,
asking it to convert the ssn to our internal id

otherwise,

2) use the id given to query an existing table

I'm not sure what feature/function postgresql has to help me do this.
I'd like to stick with using python as my language, and I'm guessing
this would be stored procedure, but I'm too new to know.

Please point me to some good reading.

--
David Bear
phone: 480-965-8257
fax: 480-965-9189
College of Public Programs/ASU
Wilson Hall 232
Tempe, AZ 85287-0803
"Beware the IP portfolio, everyone will be suspect of trespassing"

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-10-2008, 01:15 AM
Joshua D. Drake
 
Posts: n/a
Default Re: query and stored procedures

David Bear wrote:

>I'm so totally new to postgresql that I'm not sure how to word this.
>
>
>

What you want to do is create a function (store procedure)...
You can use plpythonu to do what you want. So you could create
something like this:

create or replace function check_id(text) returns integer as ...

Sincerely,

Joshua D. Drake



>I want to create a query, that does two things
>
>1) take input in the form of a string of numbers, and test if
> a) is ssn
> b) or internal id
>
>if the string is an ssn, make a second query to another data base,
>asking it to convert the ssn to our internal id
>
>otherwise,
>
>2) use the id given to query an existing table
>
>I'm not sure what feature/function postgresql has to help me do this.
>I'd like to stick with using python as my language, and I'm guessing
>this would be stored procedure, but I'm too new to know.
>
>Please point me to some good reading.
>
>
>



--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC and S/JDBC
Postgresql support, programming shared hosting and dedicated hosting.
+1-503-667-4564 - jd@commandprompt.com - http://www.commandprompt.com
PostgreSQL Replicator -- production quality replication for PostgreSQL



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:45 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com