[SQL] user defined function question

2001-08-20 Thread Joseph Syjuco

how do i return a resultset from a user defined function. pls show a simple
structure


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



[SQL]

2001-09-03 Thread Joseph Syjuco

im new in postgresql (actually came from SQL Server) and i was trying a
script like this

insert into table1(field1,field2) values (select field1, field2 from table
2);

i dont know if this is possible (inserting a set of entries via resultset
from a select stmt in one command).  If anyone has any answers, or
workarounds pls do email me

Thanks


---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://www.postgresql.org/search.mpl



[SQL] variance aggregate function incorrect? Reference Materials regcreate aggregate

2002-06-24 Thread Joseph Syjuco

hi
i needed the variance function ... i dont know if i introduced the wrong
parameters or maybe this variance is not the variance that im looking
for but it doesnt provide the right results

variance=(nEx^2 - (Ex)^2)/(n(n-1))
my sql statement
select variance(answer) from tbl_answer (where answer is of type
integer)

because of this i need to create my own variance aggregate (unless
someone enlightens me on whats happening with the variance aggregate) so
i would like to know if theres anyone who knows a good create aggregate
tutorial (with samples) ... all i got from google so far is the
reference from ninthwonder.com
TIA







---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster





[SQL] assign count() result to a declared variable in plpgsql

2002-06-24 Thread Joseph Syjuco


i want to put my count() result in a plpgsql declared integer variable


declare f_count_var integer;
begin
select into f_count_var count(empno) from employee
end;

tried this one but it doesnt work










---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly





[SQL] transaction in plpgsql

2002-06-27 Thread Joseph Syjuco

how can i implement transactions inside my plpgsql functions 






---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster





[SQL] export plpgsql function to file

2002-07-09 Thread Joseph Syjuco

how can i export my postgresql function to a file?






---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])





[SQL] how do i import my sql query result to a file

2002-07-18 Thread Joseph Syjuco

how do i import results of my select query to a file
thanks




---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Re: [SQL] how do i import my sql query result to a file

2002-07-18 Thread Joseph Syjuco

thanks for the tips !!! actually i used \g  .  Again thanks
On Thu, 2002-07-18 at 20:34, Ludwig Lim wrote:
> 
> --- Joseph Syjuco <[EMAIL PROTECTED]> wrote:
> > how do i import results of my select query to a file
> > thanks
> > 
> 
> in the psql command prompt type
> \o 
> 
> and then type your select query.
> The result will be dumped into 
> 
> ludwig.
> 
> __
> Do You Yahoo!?
> Yahoo! Autos - Get free new car price quotes
> http://autos.yahoo.com
> 
> ---(end of broadcast)---
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to [EMAIL PROTECTED] so that your
> message can get through to the mailing list cleanly



---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])



[SQL] determine if a table exists

2002-08-01 Thread Joseph Syjuco

how do i determine if a table exists using select statement
i want to find out if it exists if not ill create it if yes then ill do
some editing with it
TIA




---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster



[SQL] select case problem

2002-09-24 Thread Joseph Syjuco

i have a table with the fields empno (not null) and division_no (null
allowed) what i wanted to do is to do a select case statement such that
when division_no is null itll output 'No division' if its not null itll
output 'with division' unfortunately this statement doesnt work ... i
need help on the correct syntax

select case division_no when null then 'no division' else 'with
division' end from employee;




---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]



[SQL] getting the current date

2002-10-16 Thread Joseph Syjuco


how can i get the current date (without the time part) in sql.  I tried
doing a select now() but it also gives me the time part 
TIA
joseph




---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster