postgresql - SELECT multiple rows and columns into a record variable -


In a plpgsql function, how can multiple rows and columns be selected in a record variable?

For example, I would like many examples in a record variable of a column ( yearinteger and value ) ( SELECT yearvalues ​​).

* Edit - The following code is just part of a long function; I need the variable yearly to include several rows and columns from a table, from which I made Can be forwarded to function

  Fn_function () Returns TABLE () AS $ $ DECLARE year c.year% TYPE; Value c.value% TYPE; Year records; Selection in C for years, c.value to loop end loop; - Creating additional variables from Variable Variables of the year; $$ LANGUAGE plpgsql; 

P>

You can use a temporary table:

  • You may also use subqueries ) Local area of ​​a single question can be substituted with. A "single query" can contain many commands (in the data-modified CTE) it will be most efficient:

    or with the cursor to the cursor Combine (consider the example under FNC - Function ):



  • Comments

    Popular posts from this blog

    c# - Textbox not clickable but editable -

    Matlab transpose a table vector -

    ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -