On mið, 2008-08-06 at 18:52 +0000, CHUNRIMACHUNRIMA wrote:
> "96784002";"mylocation #1"
> "02385067";"mylocation #2"
> "01734056";"mylocation #3"
...
> 3. What I want to do is to create tables with staid from mytest table
> using for loop.
...
> +++Example+++
>
> CREATE TABLE s06784000 (
> staid varchar(50),
> val real, -- streamflow
> date date
> )
>
> WITHOUT OIDS;
what about a query that generates texts like 'CREATE TABLE s06784000 .....;'
for each row of your table? then you can either
feed the output to psql, or just EXECUTE them
in a PL/pgSQL function.
>
> 4. I must create tables using for loop because I have millions of
> records.
you want to create millions of tables? you should do a bit of
performance testing before you commit to this, as I
imagine that you might get into scalability problems.
gnari