[SQL] Adding ENUM Type

2009-09-03 Thread Simon Bateman
I have: CREATE TYPE status AS ('NEW','ACTIVE','DESPATCH','COMPLETE'); and included field in my modified version of dellstore2.sql data CREATE TABLE pg_orders ( orderid serial NOT NULL, customerid integer NOT NULL, orderdate date NOT NULL, orderstatus status, CONSTRAINT pg_orders_

Re: [SQL] LIMIT 1; The Integer part only

2009-09-03 Thread Christophe Pettus
On Sep 3, 2009, at 5:49 PM, bilal ghayyad wrote: 1) When writing the function (I mean sql function) in the postgresql, I noticed the use for LIMIT 1, but did not understand what does it mean and why we use it? It restricts the number of rows returned by the SELECT. You can find the docum

Re: [SQL] LIMIT 1; The Integer part only

2009-09-03 Thread Steve Crawford
bilal ghayyad wrote: 1) When writing the function (I mean sql function) in the postgresql, I noticed the use for LIMIT 1, but did not understand what does it mean and why we use it? Limit return to 1 record (or other specified number). Note that without ORDER BY, there is no guarantee of whi

[SQL] LIMIT 1; The Integer part only

2009-09-03 Thread bilal ghayyad
Hello List; I have two questions: 1) When writing the function (I mean sql function) in the postgresql, I noticed the use for LIMIT 1, but did not understand what does it mean and why we use it? 2) Also in the function (the sql function) in the postgresql, if I need to take the integer part of

Re: [SQL] Question

2009-09-03 Thread A. Kretschmer
In response to aymen marouani : > Hi for all, > What is the possible sources of the SQLState 55000 "OBJECT NOT IN PREREQUISITE > STATE" ? > The error 55000 was triggered when I executed the following query : > "select currval('"BatchTreatment_batch_treatment_id_seq"');" Within this session, first