From: | Rehan Saleem <pk_rehan(at)yahoo(dot)com> |
---|---|
To: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | How To Create Temporary Table inside a function |
Date: | 2012-03-02 11:23:03 |
Message-ID: | 1330687383.77274.YahooMailNeo@web121602.mail.ne1.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
hi everyone ,
how can i create temp table say table1 with three column of types varchar , int and int, inside the function body and if that same table already exist it should drop that already existing table(table1) , and on every run this process should run. and how can i insert values from postgresql view say vwfirst to this table(table1)
Here is the MS-SQL code for this process but i want to know how can this be done in postgresql
if object_id('tempdb..#tblTFSites1') is not null
drop table tempdb..#tblTFSites1
create table #tblTFSites1(
Chr varchar(50) NULL,
Start int NULL,
[End] int NULL
)
INSERTION PROCESS
INSERT INTO #tblTFSites1 (Chr, Start,[End])
Select Chr_U, Start_U, End_U from vwChrCompareSites where KBId=(at)ID and UserDataDetailId=(at)UserDataDetailId
and bpOverlap >= @bpOverlap and (CentreDistance <= @CentreDistance or @CentreDistance=1)
From | Date | Subject | |
---|---|---|---|
Next Message | Philip Couling | 2012-03-02 11:49:31 | Re: How To Create Temporary Table inside a function |
Previous Message | Adrian Klaver | 2012-03-01 19:44:45 | Re: Change Ownership Recursively |