pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
sql function
3+ messages / 3 participants
[nested] [flat]

* sql function
@ 2005-10-14 12:47  Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
  0 siblings, 1 reply; 3+ messages in thread

From: Shavonne Marietta Wijesinghe @ 2005-10-14 12:47 UTC (permalink / raw)
  To: pgsql-sql

I have 2 schemas "operativo" and "autore" and they both have a table "PECDT00" 

i want to create a function with the following sql command (using the programme pgadmin 3) in pgadmin 3 there is a small wizard to fill when u create a function and u have to add the return type..

this is the sql statement i wanna do

DELETE FROM operativo.PECDT00; 
insert into operativo.PECDT00 (select * from autore.PECDT00);

what can i use ad the return type??

thank u
 

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: sql function
@ 2005-10-14 13:18  Andreas Kretschmer <akretschmer@spamfence.net>
  parent: Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
  0 siblings, 0 replies; 3+ messages in thread

From: Andreas Kretschmer @ 2005-10-14 13:18 UTC (permalink / raw)
  To: pgsql-sql

Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it> schrieb:

> I have 2 schemas "operativo" and "autore" and they both have a table "PECDT00"
>  
> i want to create a function with the following sql command (using the programme
> pgadmin 3) in pgadmin 3 there is a small wizard to fill when u create a
> function and u have to add the return type..
>  
> this is the sql statement i wanna do
>  
> DELETE FROM operativo.PECDT00;
> insert into operativo.PECDT00 (select * from autore.PECDT00);
>  
> what can i use ad the return type??

Simple.

Open a new text file:

,----[  store this as table_copy.sql  ]
| create or replace function table_copy() returns void as $$
| delete from operative.PECDT00;
| insert into operativo.PECDT00 select * from autore.PECDT00;
| $$ language sql;
`----

Now call psql with your Database.

,----[  log from psql  ]
| test=>\i table_copy.sql
| CREATE FUNCTION
|
| test=> select table_copy();
|  table_copy
| ------------
|
| (1 Zeile)
`----


I say it again: use the fine command line tool psql to learn SQL.


Regards, Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* SQL function
@ 2007-08-27 12:05  ashok raj <ashokexplorer@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: ashok raj @ 2007-08-27 12:05 UTC (permalink / raw)
  To: pgsql-sql

Hi,
       Is there any function in postgre to know the size of the data in a
row of a table ?

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2007-08-27 12:05 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-14 12:47 sql function Shavonne Marietta Wijesinghe <shavonne.marietta@studioform.it>
2005-10-14 13:18 ` Andreas Kretschmer <akretschmer@spamfence.net>
2007-08-27 12:05 SQL function ashok raj <ashokexplorer@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox