Re: [SQL] Question
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 call nextval() for this sequence. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
[SQL] LIMIT 1; The Integer part only
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 the number, which math function can do this for me? For example, I have 3.900 and I need only the 3 (the integer part), which math function to be used? Any advise? Regards Bilal -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] LIMIT 1; The Integer part only
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 which record will show up at the top of the list. See also OFFSET. I.e. to skip the first 30 records and only return the next 10 (records 31-40) in your list: SELECT * from foo order by bar LIMIT 10 OFFSET 30; 2) Also in the function (the sql function) in the postgresql, if I need to take the integer part of the number, which math function can do this for me? For example, I have 3.900 and I need only the 3 (the integer part), which math function to be used? floor(3.900) Cheers, Steve -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] LIMIT 1; The Integer part only
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 documentation here: http://www.postgresql.org/docs/8.4/interactive/sql-select.html#SQL-LIMIT 2) Also in the function (the sql function) in the postgresql, if I need to take the integer part of the number, which math function can do this for me? floor or trunc, depending on the behavior you want for negative numbers: http://www.postgresql.org/docs/8.4/interactive/functions-math.html -- -- Christophe Pettus x...@thebuild.com -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
[SQL] Adding ENUM Type
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_pkey PRIMARY KEY (orderid) ) WITH (OIDS=FALSE) TABLESPACE datadisk; Now I have populated table, I have decided I really need a 'CANCEL' status and append it to emum.list! Without creating status2 and swapping table fields/data I cannot find an ALTER TYPE - APPEND TO ENUM command -- would response be different if I wanted to reorder values? Regards Simon Bateman _ View your other email accounts from your Hotmail inbox. Add them now. http://clk.atdmt.com/UKM/go/167688463/direct/01/