Re: [SQL] UPDATE and DELEte with a lot of register is to slow...

2008-11-21 Thread John Dizaro
 The problem is ...
how to run the SCRIPT to the few?
not all the 5 lines of "update" at the same time.
John Evan Dizaro


2008/11/20 John Dizaro <[EMAIL PROTECTED]>

> I have   to execute some times an UPDATE  an some times a DELETE  to
> register +- 5  , every time when i do that  the database  be  to slow
> do we any way to DELETE or UPDATE by part???
> Thanks
>
> --
> John Evan Dizaro  -
>
>
>


-- 
John Evan Dizaro Software -
Fone: (41) -0303
Fone: (41) 9243-3240
Rua: Alferes Poli Curitiba - PR - Brasil


[SQL] function - string ends with

2008-11-21 Thread Kevin Duffy
Hello All:

 

Is anyone aware of a function in PgSQL that will check if a string ends
with a specific string?

 

I.e.   rposition(substring in string )  returns int

Starts searching right to left within string

 

 

Thanks for your attention to this matter.

 

 

Kevin Duffy

 



Re: [SQL] BULK COLLECT

2008-11-21 Thread Scott Marlowe
2008/11/21 Paul Dam <[EMAIL PROTECTED]>:
> Hoi,
>
>
>
> Is there an equivalent in PL/pgSQL for BULK COLLECT in PL/SQL of Oracle?

I'm not that familiar with BULK COLLECT in oracle.  What does it do?

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] function - string ends with

2008-11-21 Thread Kevin Duffy
Take a look at LIKE or ILIKE  

 

 

kd



From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kevin Duffy
Sent: Friday, November 21, 2008 11:31 AM
To: [email protected]
Subject: [SQL] function - string ends with

 

Hello All:

 

Is anyone aware of a function in PgSQL that will check if a string ends
with a specific string?

 

I.e.   rposition(substring in string )  returns int

Starts searching right to left within string

 

 

Thanks for your attention to this matter.

 

 

Kevin Duffy

 



Re: [SQL] function - string ends with

2008-11-21 Thread Oliveiros Cristina
If I understand what you need, 
I guess this clause does work.


WHERE string LIKE '%substring' 

Best,
Oliveiros
  - Original Message - 
  From: Kevin Duffy 
  To: [email protected] 
  Sent: Friday, November 21, 2008 4:30 PM
  Subject: [SQL] function - string ends with


  Hello All:

   

  Is anyone aware of a function in PgSQL that will check if a string ends with 
a specific string?

   

  I.e.   rposition(substring in string )  returns int

  Starts searching right to left within string

   

   

  Thanks for your attention to this matter.

   

   

  Kevin Duffy

   


[SQL] BULK COLLECT

2008-11-21 Thread Paul Dam
Hoi,

 

Is there an equivalent in PL/pgSQL for BULK COLLECT in PL/SQL of Oracle?

 

Met vriendelijke groet,

 

Paul Dam

Informatieanalist

 

 

  


Amyyon
Bijsterhuizen 11.58

6546 AS Nijmegen

050 - 311 5686

www.amyyon.nl  

 

<>

[SQL] simple text parsing function

2008-11-21 Thread Kevin Duffy
Hello All:

 

I am requesting your kind assistance with a simple text parsing
function.

The source code for the function is below. What is interesting is that
the 

path through the code that actually does something works.  The simple 

path through the code fails.

 

For example 

select getrfs_bbcode('CHF/USD 12/17/2008 CURNCY ', null, null);
returns  "CHFUSD  CURNCY "  this is correct.

 

select getrfs_bbcode('BPZ8 CURNCY  ',  NULL, NULL);
returns nothing.  I need to receive 'BPZ8 CURNCY  '  in this
case.

 

 

What am I missing?  

 

Many thanks for your assistance.

 

KD

 

 

CREATE OR REPLACE FUNCTION getrfs_bbcode( bbcode_in bpchar,
sectype_bbsuffix_in bpchar, sectypekey_in integer )

  RETURNS character AS

$BODY$

 

DECLARE

  rtn_bbcode char(25);

  tmp_bbcode  char(25);

  abbcode char(10)[3]; 

BEGIN

 

  tmp_bbcode  := upper( rtrim(bbcode_in ) ); 

  --  

  if tmp_bbcode like '%CURNCY'  then 

 if strpos( tmp_bbcode, '/' )  > 0  then 

--  Is there / in the BB Code 

abbcode :=  string_to_array(tmp_bbcode, ' ');

rtn_bbcode := replace(abbcode[1], '/', '')  ||'  '|| abbcode[3];

 else 

rtn_bbcode := tmp_bbcode;  -- simple pass though case does
not work?!?!

 

 end if; 

 

  end if;  

 

 return  rtn_bbcode ;

 

END

$BODY$

 

LANGUAGE 'plpgsql' VOLATILE;

 

Kevin Duffy

 



[SQL] Interval Format

2008-11-21 Thread Zagato
Hi everyone... im looking for some help with the interval format between two
diferents versions of postgres
I have instaled in my old server postgres 8.0.3 and in my new one postgres
8.3.5...
Everything in both looks works nice but i notice a little difference that is
taking my crazy..
I have som SQL that in 8.0.3 do:
# SELECT '32 hours'::INTERVAL;
interval
-
 @ 1 day 8 hours
(1 row)

And in 8.3.5 do:
seg_veh2=# SELECT '@ 32 hours'::INTERVAL;
  interval

 @ 32 hours
(1 row)

Why i unable to get my old style of interval, i really need to see the day
part im using datestyle german in both im try with "SET
IntervalStyle TO..." but i get this error:
ERROR:  unrecognized configuration parameter "intervalstyle"
looking throw the forums i get that this new param its just for postgres
8.4...
So.. how can i recover my "days" part...

Any help it appreciate... thanks :D

Alan Jairo Acosta


[SQL] JOIN results of refcursor functions

2008-11-21 Thread Milan Oparnica

Hi,

Is there any way to use INNER, LEFT and RIGHT JOIN between functions 
returning refcursor type.


Explain:

function1 as refcursor
function2 as refcursor

both functions return columns a and b.

can i join the results of these functions in such manner (or any other):

function3 as refcursor

select f1.a, f2.b
from function1 as f1 inner join function2 as f2 on f1.a=f2.a;

open f3;
return f3;

Thanks,

Milan Oparnica.


--
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] Interval Format

2008-11-21 Thread Tom Lane
Zagato <[EMAIL PROTECTED]> writes:
> I have som SQL that in 8.0.3 do:
> # SELECT '32 hours'::INTERVAL;
> interval
> -
>  @ 1 day 8 hours
> (1 row)

> And in 8.3.5 do:
> seg_veh2=# SELECT '@ 32 hours'::INTERVAL;
>   interval
> 
>  @ 32 hours
> (1 row)

> Why i unable to get my old style of interval,

Because '1 day' isn't really the same thing as '24 hours', at least not
if you live anywhere that they have daylight savings time.

You can probably get the behavior you want by passing the value through
justify_hours(), which does the conversion assuming 1 day == 24 hours.

regards, tom lane

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] JOIN results of refcursor functions

2008-11-21 Thread Tom Lane
Milan Oparnica <[EMAIL PROTECTED]> writes:
> Is there any way to use INNER, LEFT and RIGHT JOIN between functions 
> returning refcursor type.

No.  Make them return setof whatever instead.

regards, tom lane

-- 
Sent via pgsql-sql mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] Interval Format

2008-11-21 Thread Zagato
Hi this seems to works... but this will need to rewrite all my sql inPHP
that uses interval can i make this default in postgres.conf or something
similar...

Thanks...

Alan Jairo Acosta

On Fri, Nov 21, 2008 at 9:15 PM, Tom Lane <[EMAIL PROTECTED]> wrote:

> Zagato <[EMAIL PROTECTED]> writes:
> > I have som SQL that in 8.0.3 do:
> > # SELECT '32 hours'::INTERVAL;
> > interval
> > -
> >  @ 1 day 8 hours
> > (1 row)
>
> > And in 8.3.5 do:
> > seg_veh2=# SELECT '@ 32 hours'::INTERVAL;
> >   interval
> > 
> >  @ 32 hours
> > (1 row)
>
> > Why i unable to get my old style of interval,
>
> Because '1 day' isn't really the same thing as '24 hours', at least not
> if you live anywhere that they have daylight savings time.
>
> You can probably get the behavior you want by passing the value through
> justify_hours(), which does the conversion assuming 1 day == 24 hours.
>
>regards, tom lane
>