Re: [SQL] Dynamic prepare possible in plpgsql?

2007-05-02 Thread Tom Lane
"Collin Peters" <[EMAIL PROTECTED]> writes: > So if I have an INSERT inside a LOOP in a plpgsql function, it is only > prepared once? Once per session, yes (barring some special cases like polymorphic functions and trigger functions, which would get prepared once per session per calling situation)

[SQL] Needs Function

2007-05-02 Thread Penchalaiah P.
I need a user defined function for the following purpose If I pass a string with comma ( , ) separated chars/values It should be appear in next line... Ex: select get_sep_str ('SK, rp, h, j, 6, 9, kl') from dual; Output : SK rp h j 6 9 kl (Or) I have one table like thi

[SQL] Needs Function

2007-05-02 Thread Penchalaiah P.
PLEASE GO TO FOLLOWING QUERY AND REVERT TO ME IF ANY QUERIES SELECT * FROM TEMP; DEPTNO EMPNO -- -- 10 B3091,B3092,B3093,B3085 11 3651,6521 12 H3062 1 SELECT DEPTNO,SUBSTR(EMPNO,

Re: [SQL] Joe Celko's method to "generate_series" not working?

2007-05-02 Thread Richard Broersma Jr
--- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > Is Mr. Celko mistaken? Does anyone know if PostgreSQL has any functions that > I can turn these > VALUES rows into columns so that the CROSS JOINS will work? Having posted, I just realized what the correct syntax is: SELECT hundred * 100

[SQL] Joe Celko's method to "generate_series" not working?

2007-05-02 Thread Richard Broersma Jr
Well, I am about a book and a-half away from reading all of the Joe Celko's books that I know of. I just came across an nice looking way to generate a series using a set oriented construct. However, I am not able to get it to work in PostgreSQL. The method follows from the SQL Programming Style

Re: [SQL] Possible to access value in RECORD without knowing column name?

2007-05-02 Thread Richard Albright
my_column = 'foo' sql = 'select col1, col2, ' || my_column || ' as bar from mytable; for myrecord in execute sql loop myvariable = myrecord.bar end loop; On Wed, 2007-05-02 at 12:17 -0700, Collin Peters wrote: > In plpgsl, if I have a RECORD variable that is populated via some > dynamic SQ

[SQL] Possible to access value in RECORD without knowing column name?

2007-05-02 Thread Collin Peters
In plpgsl, if I have a RECORD variable that is populated via some dynamic SQL, is it possible to access the columns in that RECORD object without knowing the column names? I.e. Can I grab whatever value is the 3rd column? random_colname = 'foobar'; sql = 'SELECT col1, col2, ' || random_colname |

Re: [SQL] Dynamic prepare possible in plpgsql?

2007-05-02 Thread Collin Peters
So if I have an INSERT inside a LOOP in a plpgsql function, it is only prepared once? Regards, Collin On 5/1/07, Jonah H. Harris <[EMAIL PROTECTED]> wrote: On 5/1/07, Collin Peters <[EMAIL PROTECTED]> wrote: > Is it faster to use PREPARE for the various INSERT statements inside a > plpgsql func

Re: Fwd: Re[2]: [SQL] We all are looped on Internet: request + transport = invariant

2007-05-02 Thread Richard Huxton
Dmitry Turin wrote: Good day, Richard. RH> With 7 flights it is easy to see if #2 matches #4. With 700 it is not so RH> easy to see #2 matches #504. With a tree-structure it is impossible to RH> sort leaf nodes without restructuring the tree. What is "#2 matches #4" ? Individual flights might

Re: [SQL] We all are looped on Internet: request + transport = invariant

2007-05-02 Thread Joe
Hi Dmitry, On Wed, 2007-05-02 at 08:05 +0300, Dmitry Turin wrote: > J> The average man or woman on the street > > For what you say about street ? > Average people, which you can meet on street, make physical job. That is an American colloquialism to refer to just about anyone, regardless of what