In sybase I can use the following
syntax:
select 'T' as src,(if tbon is null or tbon <
'1900/12/12' or tbon >
'1900/9/30' then 'U'
else 'P' endif)
as pres from ftrans
this returns two columns: src = '' and pres which has either
the value 'U' or 'P'
how would I express this in postgresql
select 'T' as src,(if tbon is null or tbon < '1900/12/12' or tbon > '1900/9/30' then 'U' else
'P' endif) as pres from ftrans
select 'T' as src,(CASE
WHEN tbon is null
or tbon < '1900/12/12' or tbon > '1900/9/30' THEN 'U' ELSE 'P' END)
as pres from
ftrans
I think it works in Oracle too
On Tuesday 09 September 2003 09:06, Richard Sydney-Smith wrote:
> In sybase I can use the following syntax:
>
> select 'T' as src,(if tbon is null or tbon < '1900/12/12' or tbon >
> '1900/9/30' then 'U' else 'P' endif) as pres from ftrans
>
> this returns two columns: src = 'T' and pres which has e
> The problem is we are using PostGres 7.1.In this version REPLACE() is not
> available.
It sounded like you were just starting to work on the change over. I
highly suggest upgrading to 7.3 at the very least, 7.4 if you're going
to be a few months prior to going to production. A ton of good work
On Mon, 8 Sep 2003, Tom Lane wrote:
> "scott.marlowe" <[EMAIL PROTECTED]> writes:
> > On Mon, 8 Sep 2003, Bruce Momjian wrote:
> >> I don't know how you could have an application that doesn't know if it
> >> has issued a nextval() in the current connection. Unless you can explain
> >> that, we hav
how do i get jdbc to recognize the ltree type that comes with the
contrib/ltree extension?
This:
Object object = resultSet.getObject(columnNumber);
generates the following exception:
Exception caused by: No class found for ltree
at
org.postgresql.jdbc1.AbstractJdbc1Connection.getOb
Just a teste, please ignore
---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster
I have the following query
UPDATE accumulator1 SET accumulator1.status = "User Excluded"
WHERE accumulator1.name NOT IN
(SELECT DISTINCT accumulator1.name
FROM accumulator1, diaaffectedstmts
WHERE diaaffectedstmts.stmt like '*'+ accumulator1.name +'*' and
diaaffectedstmts.xref_type <>
"D");
On Thu, 4 Sep 2003, Rod Taylor wrote:
> > 2 Also I need to find an alternative for ROWNUM in oracle..
>
> If you are looking for a unique identifier, try using the OID.
>
ROWID is oracle's unique identifier, ROWNUM is the row number in a query
result. In the past it has been suggested that R
Hi,
Do we have any replacement for REPLACE() of Oracle in PostGres?
I know we can function to do same job.
Regards
Jomon
-Original Message-
From: Kris Jurka [mailto:[EMAIL PROTECTED]
Sent: Monday, September 08, 2003 1:52 PM
To: Rod Taylor
Cc: Jomon Skariah; [EMAIL PROTECTED]
Subje
Hi,
Thanx for your reply.
The problem is we are using PostGres 7.1.In this version REPLACE() is not
available.
Regards
Jomon
-Original Message-
From: Rod Taylor [mailto:[EMAIL PROTECTED]
Sent: Monday, September 08, 2003 7:41 PM
To: Jomon Skariah
Cc: Kris Jurka; [EMAIL PROTECTED
On Tue, Sep 09, 2003 at 13:39:10 +0530,
Jainendra Kumar P <[EMAIL PROTECTED]> wrote:
> I have the following query
>
> UPDATE accumulator1 SET accumulator1.status = "User Excluded"
> WHERE accumulator1.name NOT IN
> (SELECT DISTINCT accumulator1.name
> FROM accumulator1, diaaffectedstmts
> WHER
Tom Lane wrote:
> Manfred Koizar <[EMAIL PROTECTED]> writes:
> > On Mon, 08 Sep 2003 11:40:32 -0400, Tom Lane <[EMAIL PROTECTED]>
> > wrote:
> >> 4. Use the parser's coerce_to_boolean procedure, so that nonbooleans
> >> will be accepted in exactly the same cases where they'd be accepted
> >> in a b
On Mon, 08 Sep 2003 11:40:32 -0400, Tom Lane <[EMAIL PROTECTED]>
wrote:
>4. Use the parser's coerce_to_boolean procedure, so that nonbooleans
> will be accepted in exactly the same cases where they'd be accepted
> in a boolean-requiring SQL construct (such as CASE). (By default,
> none are,
Manfred Koizar <[EMAIL PROTECTED]> writes:
> On Mon, 08 Sep 2003 11:40:32 -0400, Tom Lane <[EMAIL PROTECTED]>
> wrote:
>> 4. Use the parser's coerce_to_boolean procedure, so that nonbooleans
>> will be accepted in exactly the same cases where they'd be accepted
>> in a boolean-requiring SQL constru
Define the language! If it breaks code, so be it.
2. Throw an error if the _expression_ doesn't return boolean.
Yes, yes, absolutely.
By definition "an IF, WHILE, or EXIT statement is a boolean _expression_"
SO
if "some stupid piece of text" THEN
should not compile, there is no BOOLEAN _expre
Tom Lane wrote:
Following up this gripe
http://archives.postgresql.org/pgsql-sql/2003-09/msg00044.php
I've realized that plpgsql just assumes that the test expression
of an IF, WHILE, or EXIT statement is a boolean expression. It
doesn't take any measures to ensure this is the case or convert
t
Jan Wieck <[EMAIL PROTECTED]> writes:
> ERROR is the cleanest way, but I'd vote for conversion to boolean to
> keep the damage within reason.
Which style of conversion did you like? These were the choices:
>> 3. Try to convert nonbooleans to boolean using plpgsql's usual method
>> for cross-typ
I would suggest to throw a error, or at least a warning.
This will FORCE people to program in the correct way.
I also thought that 'IF $1 THEN ...' should work ok but giving it a other
thought it's indeed stuped to write that way (I'm from the C world...)
Ries
-Oorspronkelijk bericht-
V
Tom Lane wrote:
Following up this gripe
http://archives.postgresql.org/pgsql-sql/2003-09/msg00044.php
I've realized that plpgsql just assumes that the test expression
of an IF, WHILE, or EXIT statement is a boolean expression. It
doesn't take any measures to ensure this is the case or convert
the
Tom Lane wrote:
Jan Wieck <[EMAIL PROTECTED]> writes:
ERROR is the cleanest way, but I'd vote for conversion to boolean to
keep the damage within reason.
Which style of conversion did you like? These were the choices:
3. Try to convert nonbooleans to boolean using plpgsql's usual method
for cr
Marek Lewczuk wrote:
Hello,
I think that there is a bug in plPGSQL - or maybe I don't know something
about this language. Try to create this function
Ok., this is the function created in plPGSQL:
CREATE FUNCTION "public"."test" (text, text) RETURNS text AS'
BEGIN
IF $1 THEN
RETURN $1;
ELSE
22 matches
Mail list logo