Oracle Equivalent queries in Postgres - Mailing list pgsql-sql

From Sivannarayanreddy
Subject Oracle Equivalent queries in Postgres
Date
Msg-id 4D5BAA07.7060704@subexworld.com
Whole thread Raw
Responses Re: Oracle Equivalent queries in Postgres  (Pavel Stehule <pavel.stehule@gmail.com>)
Re: Oracle Equivalent queries in Postgres  (bricklen <bricklen@gmail.com>)
List pgsql-sql
Hello,<br /> I am checking the compatibility of my product with Postgres database and i stucked in forming the below
oracleequivalent queries in Postgres database, Could some one help me pleaseee<br /><br /> 1) Trying to get index and
correspondingcolumns  information of all the tables in mentioned schema<br /><br /> select  inx.table_name as
table_name,inx.index_name as index_name,column_name, case  ( when inx.index_type = 'IOT - TOP' then 'Y' else 'N' 
end,                                              <br />     case    <br />      when inx.uniqueness = 'UNIQUE' then
'Y'      <br />      when inx.uniqueness = 'NONUNIQUE' then 'N'     <br />     
end,                                               <br />      'N' as ignore_dup_key,                             <br
/>     cast(inc.column_position as NUMBER(10))            <br />      from    all_indexes        
inx,                          <br />      all_ind_columns     inc                            <br />       where  
inx.owner          = '" + database.toUpperCase() + "'        <br />       and     inx.table_name      =
inc.table_name              <br />       and     inx.index_name      = inc.index_name                <br />      
and    inx.owner           = inc.index_owner              <br />      and     inx.owner           =
inc.table_owner             <br />      and     inx.dropped         = 'NO' <br />      and     inx.table_name       =
'"+ tableName.toUpperCase() + "'<br />      order by inx.table_name, inx.index_name, cast(inc.column_position as
NUMBER(10))<br/><br /><br /> 2) Trying to get the columns information of all the tables in mentioned schema<br /><br />
 select  tab.TABLE_NAME, <br />                   col.COLUMN_NAME, <br />                   col.DATA_TYPE, <br />
                 cast(case  when col.CHAR_COL_DECL_LENGTH is NULL then col.DATA_PRECISION else col.CHAR_LENGTH end  as
NUMBER(10)),<br />                   cast(col.NULLABLE as CHAR(1)), <br />                   cast(col.COLUMN_ID as
NUMBER(10))<br />                   <br />          from    all_tab_columns    col, <br />                 
all_tables        tab <br />          where   tab.TABLE_NAME        = col.TABLE_NAME <br />          and    
tab.OWNER            = col.OWNER <br />          and     tab.OWNER             = '" + database.toUpperCase() + "' <br
/>         and     tab.DROPPED           = 'NO' <br />         and     tab.TABLE_NAME       = '" +
tableName.toUpperCase()+ "' <br />         order by tab.TABLE_NAME, cast(col.COLUMN_ID as NUMBER(10))<br />         <br
/><br/><br /><div class="moz-signature"></div><p style="margin-bottom: 0in;"><strong><font color="#939598"><font
face="Arial"><fontsize="2">Sivannarayanareddy Nusum</font></font></font></strong><strong><font color="#000080">
</font></strong><strong><fontcolor="#000080"><font face="Arial"><font size="2">|
</font></font></font></strong><strong><fontcolor="#0000ff"><font face="Arial"><font size="2">System Analyst(Moneta
GDO)</font></font></font></strong><fontcolor="#000080"> </font><p style="margin-bottom: 0in;"><font face="Arial"><font
size="1"style="font-size: 8pt;"><img align="BOTTOM" border="0" height="71" name="graphics1"
src="cid:part1.01010006.07070008@subexworld.com"width="190" /></font></font><p style="margin-bottom: 0in;"><font
color="#808080"><fontface="Arial"><font size="1" style="font-size: 8pt;">Subex Limited, Adarsh Tech Park, Outer Ring
Road,Devarabisannalli, Bangalore – 560037, India.<br /></font></font></font><font color="#a01e55"><font
face="Arial"><fontsize="1" style="font-size: 8pt;"><b>Phone:</b></font></font></font><font color="#000000">
</font><fontcolor="#000000"><font face="Arial"><font size="1" style="font-size: 8pt;">+91 80 6696 3371;
</font></font></font><fontcolor="#a01e55"><font face="Arial"><font size="1" style="font-size:
8pt;"><b>Mobile:</b></font></font></font><fontcolor="#000000"> </font><font color="#000000"><font face="Arial"><font
size="1"style="font-size: 8pt;">+91 9902065831</font></font></font><font color="#c1272d">  </font><font
color="#a01e55"><fontface="Arial"><font size="1" style="font-size:
8pt;"><b>Fax:</b></font></font></font><fontcolor="#000000"> </font><font color="#000000"><font face="Arial"><font
size="1"style="font-size: 8pt;">+91 80 6696 3333; </font></font></font><p style="margin-bottom: 0in;"><font
color="#a01e55"><fontface="Arial"><font size="1" style="font-size: 8pt;"><b>Email:</b></font></font></font><font
color="#c1272d"> </font><font color="#c1272d"><font face="Arial"><font size="1" style="font-size: 8pt;"><a
href="mailto:email.id@subexworld.com">sivannarayanreddy@subexworld.com</a>;</font></font></font><font
color="#a01e55"><fontface="Arial"><font size="1" style="font-size: 8pt;"><b>URL:</b></font></font></font><font
color="#c1272d"> </font><a href="http://www.subexworld.com/"><font color="#c1272d"><font face="Arial"><font size="1"
style="font-size:              8pt;">www.subexworld.com</font></font></font></a><font color="#c1272d"> </font><p
style="margin-bottom:0in;"><font color="#c1272d"> </font><p class="msonormal"><font color="#808080"><font
face="Arial"><fontsize="1" style="font-size: 8pt;"><i>Disclaimer: This e-mail is bound by the terms and conditions
describedat </i></font></font></font><a href="http://www.subexworld.com/mail-disclaimer.html"><font face="Arial"><font
size="1"style="font-size: 8pt;"><i>http://www.subexworld.com/mail-disclaimer.html</i></font></font></a><font
color="#808080"><br/></font> 

pgsql-sql by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: PL/SQL block error
Next
From: Pavel Stehule
Date:
Subject: Re: Oracle Equivalent queries in Postgres