Interchange the value of a column Gender in a table where
values are Male and Female. So, where the value is Male, it
should changed to Female and Female to Male.
Answers were Sorted based on User's Feedback
Answer / parli jain
Update table_name
set Gender = decode (Gender, 'M', 'F', 'F,'M')
where Gender In ('M','F');
Is This Answer Correct ? | 29 Yes | 4 No |
Answer / raghu
UPDATE TABLE_NAME
SET GENDER=( CASE GENDER
WHEN 'M' THEN 'F'
WHEN 'F' THEN 'M'
END )
WHERE GENDER IN('M','F')
Is This Answer Correct ? | 22 Yes | 2 No |
Answer / ram
UPDATE TABLE
SET GENDER=(CASE GENDER
WHEN 'M' THEN 'F'
WHEN 'F' THEN 'M'
END) WHERE GENDER IN ('M','F')
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sushma s
Update table_name
Set gender = decode(gender,'M','F','M');
Is This Answer Correct ? | 8 Yes | 9 No |
Can we use rowid as primary key?
What mean sql?
how to give permission to users that users can update/insert/delete on a row of table on timeing 10am to 6pm only?
What are the string functions in sql?
Can we insert in sql function?
Types of joins ?
3 Answers Digital GlobalSoft, HeadStrong,
What can you do with pl sql?
Why sql query is slow?
How many columns should be in an index?
What are the different types of constraints?
What is pragma exception and how, when, where us
How many database objects (trigger, packages, sequence etc) uses a particular field in a given table. For ex: I want to know how many database object uses the ATTRIBUTE1 in the PO_VENDORS table. What query will give me the result showing the database object name(package, trigger etc), field_name used (in this case ATTRIBUTE1) and table_name (in this case PO_VENDORS).