[SQL] RE: [SQL] Display message to use r

2008-11-04 Thread Bart van Houdt
Hello Fernando,

 

Thank you for the quick response. 

When setting the parameter, the output changed to:

 

psql:d:/tmp/pg/migrate.sql:4: NOTICE:  Joeho!

 write_line



 

(1 row)

 

Which looks a lot better already! And you have given me new hope and a new 
angle to look at :)

Regards,

 

Bart van Houdt

Syfact International B.V.

Database developer

 

From: Fernando Hevia [mailto:[EMAIL PROTECTED] 
Sent: dinsdag 4 november 2008 14:25
To: Bart van Houdt; [email protected]
Subject: RE: [SQL] Display message to user

 

Hi Bart,

 

If you are using psql then you can get rid of those messages by entering on the 
psql prompt:

 

\set verbose TERSE

 

If you are using pgAdmin, sadly there is currently no way for this application 
to filter context messages.

 

Regards,

Fernando

 





De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] En nombre de Bart van 
Houdt
Enviado el: Martes, 04 de Noviembre de 2008 10:32
Para: [email protected]
Asunto: [SQL] Display message to user

Hi all,

 

I am a Postgres-newbie and working on porting our code from Oracle to 
Postgres.

Oracle has a nice package procedure (dbms_output.put_line) to display a 
message in SQL*Plus, which can display a message to the user. I use this a lot, 
to notify users of the progress being made during the execution of a script. 

Is there a way to do this with Postgres as well?

 

I have tried using ‘RAISE NOTICE’, but using this some extra lines are 
printed on screen. Those extra lines mess up the screen and will confuse the 
users. The extra lines shown are:

 

CONTEXT:  SQL statement "SELECT  migration_pkg.time_migration( $1 ,  $2 
)"

PL/pgSQL function "check_migration" line 34 at PERFORM

 

Any help would be appreciated,

 

Bart van Houdt

Syfact International B.V.

Database developer

 

 



[SQL] need help in building a query

2008-11-04 Thread Devil™ Dhuvader
hi,
I need some help in creating a sql.
the problem is as below.

assume that:
I am a store keeper
and I have the list of customer(user_id) transactions in my order table.
schema: Orders(order_id, user_id, amount_paid, create_timestamp)

I want to give discount of 10% for the customer who made orders of worth
(sum) at least $500 in the least time from now (i.e last few days, but NOT
ALL TIME LEAST TIME TO BUY $500 WORTH GOODS).
and 9% discount for the customer who made $500 in second least time from
now.
and so on

there is no time constraint.
it customer could take any amount of time to make $500.
the customer might not even made $500 bill till now in that case I should
get the first date.

the result can take upto the first entry time of the table itself.

in short its like sum up entries of each user in order table backwards (i.e
from last entry to the first) and find the entry that has sum > $500.
If there is some user who didnt even make 500 till now in my shop return the
first date of transaction/order.

can anyone help me on this?


Re: [SQL] Display message to user

2008-11-04 Thread Fernando Hevia
Hi Bart,
 
If you are using psql then you can get rid of those messages by entering on
the psql prompt:
 
\set verbose TERSE
 
If you are using pgAdmin, sadly there is currently no way for this
application to filter context messages.
 
Regards,
Fernando


  _  

De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
En nombre de Bart van Houdt
Enviado el: Martes, 04 de Noviembre de 2008 10:32
Para: [email protected]
Asunto: [SQL] Display message to user



Hi all,

 

I am a Postgres-newbie and working on porting our code from Oracle to
Postgres.

Oracle has a nice package procedure (dbms_output.put_line) to display a
message in SQL*Plus, which can display a message to the user. I use this a
lot, to notify users of the progress being made during the execution of a
script. 

Is there a way to do this with Postgres as well?

 

I have tried using 'RAISE NOTICE', but using this some extra lines are
printed on screen. Those extra lines mess up the screen and will confuse the
users. The extra lines shown are:

 

CONTEXT:  SQL statement "SELECT  migration_pkg.time_migration( $1 ,  $2 )"

PL/pgSQL function "check_migration" line 34 at PERFORM

 

Any help would be appreciated,

 

Bart van Houdt

Syfact International B.V.

Database developer

 

 



[SQL] Display message to user

2008-11-04 Thread Bart van Houdt
Hi all,

 

I am a Postgres-newbie and working on porting our code from Oracle to
Postgres.

Oracle has a nice package procedure (dbms_output.put_line) to display a
message in SQL*Plus, which can display a message to the user. I use this
a lot, to notify users of the progress being made during the execution
of a script. 

Is there a way to do this with Postgres as well?

 

I have tried using 'RAISE NOTICE', but using this some extra lines are
printed on screen. Those extra lines mess up the screen and will confuse
the users. The extra lines shown are:

 

CONTEXT:  SQL statement "SELECT  migration_pkg.time_migration( $1 ,  $2
)"

PL/pgSQL function "check_migration" line 34 at PERFORM

 

Any help would be appreciated,

 

Bart van Houdt

Syfact International B.V.

Database developer