Enlightensoft's Blog

Helping in your each step

  • Categories

  • Authors

Archive for the ‘Oracle’ Category

Oracle

Nth Highest record in Oracle

Posted by Pankil Patel on April 18, 2012

First solution:

nth highest record from Bv_Category table based on Indvl_Rank_Id

select * From
(
Select C.*, Dense_Rank() Over (Order By C.Indvl_Rank_Id Desc) Ranking From Bv_Category C
)
where Ranking = (nth index)

Example: Record with Second Highest Indvl_Rank_Id

select * From
(
Select C.*, Dense_Rank() Over (Order By C.Indvl_Rank_Id Desc) Ranking From Bv_Category C
)
where Ranking = 2

For more detail visit:

http://www.oratable.com/nth-highest-salary-in-oracle/

Second solution:

Example: Second Highest Indvl_Rank_Id

Select Min(Indvl_Rank_Id) From (
select * from (
Select Unique Indvl_Rank_Id From
Bv_Category
ORDER BY Indvl_Rank_Id DESC) where ROWNUM <= 2)

Posted in Database, Oracle | Tagged: , | Leave a Comment »

jPub Object Generation Command

Posted by Pankil Patel on January 11, 2012

set path=%path%.;C:\oracle\product\10.2.0\client_1\BIN;

set classpath=%classpath%;.;C:\oracle\product\10.2.0\client_1\sqlj\lib\runtime12.jar;C:\oracle\product\10.2.0\client_1\sqlj\lib\translator.jar;C:\oracle\product\10.2.0\client_2\jdbc\lib\ojdbc14.jar;c:\xmlparserv2.jar;C:\oracle\product\10.2.0\client_1\sqlj\lib\runtime12ee

jpub -url=jdbc:oracle:thin:@<HostName>:15000/<service name> -user=username/password -omit_schema_names -package=co.cc.enlightensoft.demo.vote.db.dto -sql=BV_OBJ_FIRM_ARRARY_TAB:UserDBDto -tostring=true -dir=C:\jpub

Posted in Database, Oracle | Leave a Comment »

Command to copy table in same database schema

Posted by Pankil Patel on April 8, 2011

create table ABC_COPY as select * from ABC;

Note: It will create new table ABC_COPY in same schema as table ABC, with all data in new table same as original table data.

But new table doesn’t having any constrains created as they are in original table.

You need to add/execute alter script yourself to add constrain in new table.

Posted in Database, Oracle | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.