[SQL] save sql result to file

2004-12-24 Thread william lim
how to save sql result to a text file in database-backup format?
I want to backup a portion of data from my query to files and can do restore 
from them.

Thanks

William

___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.
-- 
___
Find what you are looking for with the Lycos Yellow Pages
http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10


---(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


[SQL] commit inside plpgsql function

2004-12-24 Thread Dennis Sacks
Hi,
I am converting oracle stored procedures to plpgsql. There are several 
of the oracle procedures where a parameter vCommit is passed into the 
procedure and:

if vCommit = 1
   then
   commit;
   do_something_commit(vdate);
   else
   do_something(vdate);
   end if;
does this make sense in plpgsql? Does it make sense to do a commit in 
plpgsql?

Thanks,
Dennis
---(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


[SQL] Unable to execute Java Progarm

2004-12-24 Thread Anil Kumar



Dear Sir,
When I tried to execute sample Java 
program using
Postgresql its showing  runtime error 

Exception in thread "main" 
java.lang.NoClassDefFoundError: 
java/sql/Savepoint    at 
org.postgresql.Driver.connect(Driver.java:183)    
at 
java.sql.DriverManager.getConnection(DriverManager.java:517)    
at 
java.sql.DriverManager.getConnection(DriverManager.java:177)    
at NotificationTest.main(NotificationTest.java:13)Pl give me the solution 
for this problem
Waiting eagerly for ur reply
 
Regards
Anil Kumar.S
BEGIN:VCARD
VERSION:2.1
N:Kumar;Anil
FN:Anil Kumar
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
REV:20041222T120758Z
END:VCARD

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [SQL] save sql result to file

2004-12-24 Thread Guy Fraser
Off the top of my head:

psql -c "select  into dump_table from old_table  ;" database
pg_dump -t dump_table -f dump_table.tmp database
sed -e "s/dump_table/table_name/g" dump_table.tmp >table_name.sql
rm dump_table.tmp

You should now have a file called table_name.sql with the stuff 
required to create a new table called table_name with the data 
from your query.

On Thu, 2004-23-12 at 20:44 -0800, william lim wrote: 
> how to save sql result to a text file in database-backup format?
> I want to backup a portion of data from my query to files and can do restore 
> from them.
> 
> Thanks
> 
> William
> 
> ___
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.


---(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


Re: [SQL] commit inside plpgsql function

2004-12-24 Thread Gregory S. Williamson

Already been answered (by me) -- you can't do this in postgres 7.x or earlier 
-- procedures may not have begins/commits or rollbacks. Version 8.0 *may* be 
different -- I don't have it installed yet; it does allow for some nesting of 
transactions but I don't know if this is allowed. The 8.0 documentation on user 
defined procedures would probably say.

Greg Williamson
DBA
GlobeXplorer LLC



-Original Message-
From:   Dennis Sacks [mailto:[EMAIL PROTECTED]
Sent:   Tue 12/21/2004 9:21 AM
To: pgsql-sql@postgresql.org
Cc: 
Subject:[SQL] commit inside plpgsql function
Hi,

I am converting oracle stored procedures to plpgsql. There are several 
of the oracle procedures where a parameter vCommit is passed into the 
procedure and:

if vCommit = 1
then
commit;
do_something_commit(vdate);
else
do_something(vdate);
end if;

does this make sense in plpgsql? Does it make sense to do a commit in 
plpgsql?

Thanks,

Dennis

---(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




---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings