problem was in casts
that I was using were confusing the parser and were un-necessary.
Appreciate your thought and effort.
Regards
Dave
From: Yasin Sari [mailto:yasinsar...@googlemail.com]
Sent: Tuesday, June 30, 2015 3:26 AM
To: Day, David
Subject: Re: [GENERAL] plpgsql question: select into
"David G. Johnston" writes:
> On Mon, Jun 29, 2015 at 4:27 PM, Tom Lane wrote:
>> ... So what you wrote here is equivalent to
>>
>> SELECT MIN(CAL_DATE),MAX(CAL_DATE) ::date, last_weekend::date INTO
>> first_weekend FROM sys.calendar ...
> âDoes it help to recognize the fact that "first_week
On Mon, Jun 29, 2015 at 4:27 PM, Tom Lane wrote:
> Adrian Klaver writes:
> > On 06/29/2015 12:07 PM, Day, David wrote:
> >> What is wrong with my usage of the plpgsql "select into" concept
> >> I have a function to look into a calendar table to find the first and
> >> Last weekend date of a mon
-Original Message-
From: Adrian Klaver [mailto:adrian.kla...@aklaver.com]
Sent: Monday, June 29, 2015 4:03 PM
To: Day, David; pgsql-general@postgresql.org
Subject: Re: [GENERAL] plpgsql question: select into multiple variables ?
On 06/29/2015 12:07 PM, Day, David wrote:
>
Adrian Klaver writes:
> On 06/29/2015 12:07 PM, Day, David wrote:
>> What is wrong with my usage of the plpgsql "select into" concept
>> I have a function to look into a calendar table to find the first and
>> Last weekend date of a month.
>>
>> create or replace function sys.time_test ()
>> ret
On 06/29/2015 12:07 PM, Day, David wrote:
Hi,
Postgres version 9.3.9
What is wrong with my usage of the plpgsql "select into" concept
I have a function to look into a calendar table to find the first and
Last weekend date of a month.
In this simplified concept function I end up with a NULL
Hi,
Postgres version 9.3.9
What is wrong with my usage of the plpgsql "select into" concept
I have a function to look into a calendar table to find the first and
Last weekend date of a month.
In this simplified concept function I end up with a NULL for first or last
weekend variable.
cr
On Monday, December 05, 2011 6:59:32 am Gauthier, Dave wrote:
> v8.3.4 on linux
>
> Is there a way to set the query used in a "for rec in (query) loop -> end
> loop" be a variable? Example
>
> if (foo = 'whatever')
> then
> sqlstmt := "select x,y,z ...";
> else
> sqlstmt := "select a,b,c ...
v8.3.4 on linux
Is there a way to set the query used in a "for rec in (query) loop -> end loop"
be a variable? Example
if (foo = 'whatever')
then
sqlstmt := "select x,y,z ...";
else
sqlstmt := "select a,b,c ...";
end if ;
for therec in
sqlstmt
loop
...
end loop;
Thanks in Advance f
Hello
you used a wrong syntax
see
http://www.pgsql.cz/index.php/PL/pgSQL_%28en%29#Usage_PL.2FpgSQL_function_with_parametres_of_type_table
Regards
Pavel Stehule
2010/8/28 Jon Griffin :
> I am trying to calculate a value from a current record in a query and can't
> seem to get it working.
>
>
I am trying to calculate a value from a current record in a query and
can't seem to get it working.
Here is the shortened query;
SELECT
s.id,
r.the_date_time,
s.open_price,
s.high_price,
s.low_price,
s.close_price,
thesheet_onepair.symbol,
r.buy_l
Terminology point: you used the word "aggregate" but the function below doesn't have an aggregate. Aggregates are functions thatoperate on multiple rows, like count() and sum(); substr() doesn'tdo that so it's not an aggregate. ya. my mistake.[snip] 1. Create a composite type with the
On Mon, Jan 09, 2006 at 01:01:33PM -0800, Matthew Peter wrote:
> One other quick question, (figure it still applies to the subject
> line :) when returning a row from a function I'm trying to include an
> aggregate, but it's not showing up in the query result and I think
> it's because it's not
snip WHERE my_tbl_id = $1AND CASE WHEN $2 IS NULL THEN TRUE ELSE $2 = username ENDor WHERE my_tbl_id = $1 AND COALESCE($2 = username, TRUE)or WHERE my_tbl_id = $1 AND COALESCE($2, username) = usernameWith predicates such as these you wouldn't need to use EXECUTE andyou could write the query
Michael Fuhr <[EMAIL PROTECTED]> wrote: On Fri, Jan 06, 2006 at 01:14:38AM -0800, Matthew Peter wrote:> Michael Fuhr wrote:> > On Thu, Jan 05, 2006 at 12:50:34AM -0800, Matthew Peter wrote:> > > Is it possible to skip the loop and just return all records in a> > > single query and shove all those
On Fri, Jan 06, 2006 at 01:14:38AM -0800, Matthew Peter wrote:
> Michael Fuhr <[EMAIL PROTECTED]> wrote:
> > On Thu, Jan 05, 2006 at 12:50:34AM -0800, Matthew Peter wrote:
> > > Is it possible to skip the loop and just return all records in a
> > > single query and shove all those rows into a table
Michael Fuhr <[EMAIL PROTECTED]> wrote: On Thu, Jan 05, 2006 at 12:50:34AM -0800, Matthew Peter wrote:> Is it possible to skip the loop and just return all records in a> single query and shove all those rows into a table variable?Not in PL/pgSQL -- you need to return each row with RETURN NEXT,gene
On Thu, Jan 05, 2006 at 12:50:34AM -0800, Matthew Peter wrote:
> Is it possible to skip the loop and just return all records in a
> single query and shove all those rows into a table variable?
Not in PL/pgSQL -- you need to return each row with RETURN NEXT,
generally from within a loop. Why do yo
On 1/5/06, Matthew Peter wrote: > I'm trying to do a simple SELECT * in plpgsql that returns a set of records > as a row w/ columns, not a row into a variable, w/ some conditionals. > > The function below is semi-pseudo with what I'm trying to... If anyone > could give me an example that wor
Assuming records is the name of a table...
create or replace function getrecord(int,text) RETURNS SETOF records as $$
DECLARE
row records%rowtype;
BEGIN
FOR row IN SELECT * FROM my_tbl
WHERE ...
LOOP
RETURN NEXT row;
END LOOP;
RETURN;
END;
$$ LANGUAGE plpgsql;
On 1/5/06, Matthew Peter <[EMAIL
I'm trying to do a simple SELECT * in plpgsql that returns a set of records as a row w/ columns, not a row into a variable, w/ some conditionals. The function below is semi-pseudo with what I'm trying to... If anyone could give me an example that works by returning it as a resultset maintain
DECLARE
RowsAffected INTEGER;
BEGIN
-- DO your statement
GET DIAGNOSTICS RowsAffected = ROW_COUNT;
END
On Tuesday 25 November 2003 02:56 pm, Brian Hirt wrote:
> I'm looking to find out how many rows were effected during an update in
> a trigger. I ran across this message by jan talking abou
I'm looking to find out how many rows were effected during an update in
a trigger. I ran across this message by jan talking about this feature
possibly being added to postgresql 6.5, but I can't find any reference
to such a feature in the current documentation. Did this ever make it
into pos
Steve Wampler <[EMAIL PROTECTED]> writes:
> PostgreSQL 6.5.3
>
> appdb=> create function insert_or_update() returns opaque as '
> appdb'> begin
> appdb'> insert into attributes_table values(new.id,new.name,
> appdb'>new.units,new.value);
> appdb'> return NULL;
> appdb
24 matches
Mail list logo