You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by si...@portosdobrasil.gov.br on 2010/03/03 15:39:10 UTC

How to run postgreSQL script from inside of another script

Thanks for your feed back but \i script.sql does not work.

In fact, I have a main script that calls 3 other scripts.

Within Oracle it looks like this:

/*==============================================================*/
/* Main script mainScript.sql that will create and populate DB   
/*==============================================================*/
@createTables;
@populateTables;
@selectTableValues;

I need to know how this script would look like for PostgreSQL, since this
one does not work, resulting in error.

Any help is welcome.

Thanks

Siomara



-----Mensagem original-----
De: Daniel H A Lima [mailto:email_daniel_h@yahoo.com.br] 
Enviada em: terça-feira, 2 de março de 2010 16:31
Para: Commons Users List
Assunto: Re: running postgreSQL script

Take a look at:

http://download.oracle.com/docs/cd/B10501_01/server.920/a90842/ch13.htm
http://www.postgresql.org/files/documentation/books/aw_pgsql/node143.html

--- Em ter, 2/3/10, Daniel H A Lima <em...@yahoo.com.br> escreveu:

De: Daniel H A Lima <em...@yahoo.com.br>
Assunto: Re: running postgreSQL script
Para: "Commons Users List" <us...@commons.apache.org>
Data: Terça-feira, 2 de Março de 2010, 16:29

@script_name is a SQL Plus sintax

If you are using psql (PostgreSQL command line), you can try \i script_name



--- Em ter, 2/3/10, siomara@portosdobrasil.gov.br
<si...@portosdobrasil.gov.br> escreveu:

De: siomara@portosdobrasil.gov.br <si...@portosdobrasil.gov.br>
Assunto: running postgreSQL script
Para: user@commons.apache.org
Data: Terça-feira, 2 de Março de 2010, 16:13

Does anybody know how to cal a postgreSQL script from inside of another one?

With Oracle I used:

@script.sql

Does anyone know the equivalent with postgreSQL?

Thanks

Siomara



     
____________________________________________________________________________
________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com


 
____________________________________________________________________________
________
Veja quais são os assuntos do momento no Yahoo! +Buscados
http://br.maisbuscados.yahoo.com

Re: How to run postgreSQL script from inside of another script

Posted by Daniel Henrique Alves Lima <em...@yahoo.com.br>.
Juan is right. You can also try:

\cd /absolute/path/to/scripts/
\i script1.sql
\i script2.sql

http://www.postgresql.org/docs/8.1/static/app-psql.html



On Wed, 2010-03-03 at 09:56 -0500, Juan Romero wrote:
> On Wed, Mar 3, 2010 at 9:39 AM,  <si...@portosdobrasil.gov.br> wrote:
> > Thanks for your feed back but \i script.sql does not work.
> >
> 
> Try with:
> 
> \i /absolute/path/to/scripts/script.sql
> 
> 
> Juan Gabriel Romero Silva
> Colombia

-- 
"If there must be trouble, let it be in my day, 
 that my child may have peace."

Thomas Paine



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: How to run postgreSQL script from inside of another script

Posted by Juan Romero <jg...@gmail.com>.
On Wed, Mar 3, 2010 at 9:39 AM,  <si...@portosdobrasil.gov.br> wrote:
> Thanks for your feed back but \i script.sql does not work.
>

Try with:

\i /absolute/path/to/scripts/script.sql


Juan Gabriel Romero Silva
Colombia

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org