If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > PL/PgSQL-question

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-22-04, 15:15
tlange tlange is offline
Registered User
 
Join Date: Feb 2004
Posts: 6
PL/PgSQL-question

Hello,
I'm new to PL/PgSQL. Although I'm more or less familiar with other programing languages, including general-purpose SQL, I feel like the first man here.

I want to load a table into an array to arrange the fields new (like a pivot table) and perform some calculations in dependence of a specific field value. But I don't manage to get over the probably very simple basic stuff. I also fail getting a clue from the docs.

Could anyone please provide a _very_simple_ example which way this is usually done?

Lets say I have a table:
table_name with columns of different datatypes:
t_id(integer), parameter(varchar(50)), value(number(n,m))

Now I want to read all datasets into an array and give just all datasets from the array back to the screen.

Appreciating your help,
Torsten
Reply With Quote
  #2 (permalink)  
Old 06-24-04, 04:28
eperich eperich is offline
Registered User
 
Join Date: Sep 2001
Location: Vienna
Posts: 400
Table functions

Maybe you look further into the topic table functions

this may solve your problem
__________________
http://www.postgresql.org
--Postgresql is the only kind of thing--
Reply With Quote
  #3 (permalink)  
Old 06-24-04, 04:41
tlange tlange is offline
Registered User
 
Join Date: Feb 2004
Posts: 6
Thank you, I try a shy look,

Torsten
Reply With Quote
  #4 (permalink)  
Old 06-28-04, 10:16
Edje Edje is offline
Registered User
 
Join Date: Mar 2004
Posts: 110
Personally i wouldnt do such an operation on the db.

I'd create an api in (for example php) that fetches the rows and then let the php engine do the work so there is less stress on the db.
Reply With Quote
  #5 (permalink)  
Old 06-28-04, 11:17
tlange tlange is offline
Registered User
 
Join Date: Feb 2004
Posts: 6
Yes, I thought about it too, because I query the database from php - thats why... But nobody around me saying I would do it that way because... So I thought the database engine could handle this much faster, since the web-server is under stress anyway, and there is only a very limited group of people having access to these tables. They also access the db only occasionally.

Torsten
Reply With Quote
  #6 (permalink)  
Old 10-22-04, 06:57
majordomo2 majordomo2 is offline
Registered User
 
Join Date: Mar 2004
Posts: 3
db has to do its part of job

purpose of dbms is to store get and manage data!

why should i let php do the job, when db server can
retrive, sort and give back to my php script data?

HTML/XHTML <-----------------> PHP/JSP <------------------> DBMS

Everyone has its own part of job .... Let them do that .....

best regards,
[m]
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On