Exforsys

Online Training

Oracle queries

This is a discussion on Oracle queries within the Oracle Tutorials forums, part of the Articles and Tutorials category; Dear friends i am in trouble can u plzzzz help me .i have 2 questions plz sove it 1- i ...


Go Back   Exforsys > Articles and Tutorials > Oracle Tutorials

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-02-2007, 06:02 AM
Junior Member
 
Join Date: Jan 2007
Posts: 1
ashish_ietk2000 is on a distinguished road
Oracle queries

Dear friends
i am in trouble can u plzzzz help me .i have 2 questions plz sove it

1- i have to use if condition with select statement
2-make such type of query so that it deletes duplicate data in a table

Thanx
Ashish Pandey
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-16-2007, 02:18 PM
Junior Member
 
Join Date: Jan 2007
Posts: 1
srinu.oracle is on a distinguished road
Answer for second question

To eleminate duplicate rows use this one and try it.
select distinct job from emp;
useing decode function we can implement the if condition in select statement.i don't know exact quary i will send tomarrow.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-20-2007, 01:44 PM
Junior Member
 
Join Date: Jan 2007
Posts: 2
vanimohankumar is on a distinguished road
hello friend

for deleting duplicate values in table use following query

delete * from table_name
where row_id < (select max(row_id) from table_name
group by column_name);

this query wll delete the duplicates rows
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-16-2007, 04:46 PM
Member
 
Join Date: Apr 2006
Posts: 98
Angela is on a distinguished road
Ashish did you try the suggestions given by our friends here in this thread. What is the result? Is your problem solved? Let us know so that we could know your status of query
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 05-11-2007, 12:14 AM
Junior Member
 
Join Date: Apr 2007
Posts: 2
Abdul Qadeer is on a distinguished road
Let me know if it works in deleting duplicate rows.

1. In order to user it in if statement you have to make procedure,or cursor
then use this syntax in then condition.

delete from table_name where rowid not in (select max(rowid)
from table_name group by column_name); (not null column).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 06-25-2007, 06:24 AM
Junior Member
 
Join Date: Jun 2007
Posts: 8
psiva_exforsys is on a distinguished road
Delete duplicate rows and decode function in SQL query

we can delete the duplicate records from the table using with the below querys

delete ename from emp a where rowid < (select min(rowid) from emp b
where a.rowid<=b.rowid);


Decode function:

we can select the employee based on the sex(male (M) and Female(F) using decode function

select decode(M,'Male',1,
decode (F,'Female,0) from emp;

Syntax for decode like if...than...else

IF s = search1
THEN result1
ELSE default
Exercises


Regards,
Siva.P
Bangalore
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Oracle Corporation Walkin at MUMBAI on Feb 19, 06 lokeshm Experienced Job Seekers - India 1 02-15-2007 03:47 PM
**hot - Sr. Oracle Architect, VA** Annna USA Jobs 0 10-10-2006 10:53 AM
Oracle Apps Technical / Functional Consultants sunilk123 Experienced Job Seekers - India 0 06-30-2006 01:52 AM
Oracle Completes Acquisition Of Siebel rjames Siebel 0 05-08-2006 11:15 PM
Employee Referral Walk-in - SAP, Java, Oracle, .NET and Siebel kalareddy Experienced Job Seekers - India 0 09-15-2005 02:46 AM


All times are GMT -4. The time now is 06:21 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.