Re: [GENERAL] help with a procedure

2014-06-05 Thread Adrian Klaver
On 06/05/2014 09:45 AM, Carlos Carcamo wrote: Just a little, I will read it again, thanks for your help. In particular: http://www.postgresql.org/docs/9.3/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING -- Adrian Klaver adrian.kla...@aklaver.com -- Sent via pgsql-g

Re: [GENERAL] help with a procedure

2014-06-05 Thread David G Johnston
Carlos Carcamo wrote > SELECT myProcedure(product_id, p_description, price, qty, store_id, > store_description ); > > waiting for a response from procedure, maybe true or false. Note that forcing the procedure to return false instead of simply throwing an error is going to degrade performance. I

Re: [GENERAL] help with a procedure

2014-06-05 Thread Carlos Carcamo
Just a little, I will read it again, thanks for your help. 2014-06-05 10:39 GMT-06:00 David G Johnston : > > Have you read this chapter of the documentation? > > http://www.postgresql.org/docs/9.3/interactive/plpgsql.html > > > Carlos Carcamo wrote > > What I need is some help with the procedure

Re: [GENERAL] help with a procedure

2014-06-05 Thread David G Johnston
Have you read this chapter of the documentation? http://www.postgresql.org/docs/9.3/interactive/plpgsql.html Carlos Carcamo wrote > What I need is some help with the procedure in postgres, I have searched > in > google, but I dont know how to do it, the goal is perform the first insert > and th

Re: [GENERAL] help with a procedure

2014-06-05 Thread Carlos Carcamo
What I need is some help with the procedure in postgres, I have searched in google, but I dont know how to do it, the goal is perform the first insert and then the second insert if the first one succeed in one procedure instead of using two separate inserts. Do you have some code like that? 2014-

Re: [GENERAL] help with a procedure

2014-06-05 Thread Seref Arikan
Sorry, I meant: "calling a stored procedure you'll write in postgres from php" On Thu, Jun 5, 2014 at 5:13 PM, Seref Arikan wrote: > Hi Carlos, > When you say procedures, do you mean calling a stored procedure you'll > write from php? Or executing the individual INSERT from php sequentially? >

Re: [GENERAL] help with a procedure

2014-06-05 Thread Seref Arikan
Hi Carlos, When you say procedures, do you mean calling a stored procedure you'll write from php? Or executing the individual INSERT from php sequentially? For the first scenario, you'd need to write a postgresql stored procedure (I suggest you google: PL/pgSQL tutorial) and call the from php. For

Re: [GENERAL] help with a procedure

2014-06-05 Thread Seref Arikan
Hi Carlos, Unless I'm missing something here, your queries are probably being called from a programming language (java/c# etc) and your database access api should support transactions. If you perform both operations under the same db transaction and commit your transaction things should be fine. If

Re: [GENERAL] help with a procedure

2014-06-05 Thread Carlos Carcamo
2014-06-05 9:32 GMT-06:00 Carlos Carcamo : > Hi everyone, I wonder if you could help me with a procedure that I would > like to perform in postgresql. > > I have an insert query like this: > > INSERT INTO products (product_id, description, price, qty, ...) values > ('01', 'some description', 10.15

[GENERAL] help with a procedure

2014-06-05 Thread Carlos Carcamo
Hi everyone, I wonder if you could help me with a procedure that I would like to perform in postgresql. I have an insert query like this: INSERT INTO products (product_id, description, price, qty, ...) values ('01', 'some description', 10.15, 5, ...) then if there is no problem, perform another