Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9073559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:26:43+00:00 2026-06-16T18:26:43+00:00

I just have an odd question. I know it may be funny but I

  • 0

I just have an odd question. I know it may be funny but I just have a curiosity about this.
Here is my question in detail:

Suppose there is a column in database named ‘gender’ that has boolean value i.e. either 0 or 1. 0=Male and 1=Female.
Now when we display data of a form that has this type of field, we have to do code, that (gender=0)?Male:Female.

Now I just want to know if sql provide any way, where automatically when a Record Set is generated, all gender value is replaced by Male or Female automatically. i.e. no need of this one line code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T18:26:44+00:00Added an answer on June 16, 2026 at 6:26 pm

    aside from case/decode which others have shown, in 11gR1 onwards we can have a virtual Column.

    SQL> create table test(name varchar2(20), gender number(1));
    
    Table created.
    
    SQL> insert into test values ('Paul', 0);
    
    1 row created.
    
    SQL> insert into test values ('Vicky', 1);
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL> alter table test add (gender_str varchar2(6) generated always as (case gender when 0 then 'Male' when 1 then 'Female' end));
    
    Table altered.
    
    SQL> select * from test;
    
    NAME                                         GENDER GENDER
    -------------------- ------------------------------ ------
    Paul                                              0 Male
    Vicky                                             1 Female
    

    you can index virtual columns too if you so desire.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is not exactly a straight-out question because I have just solved it, but
I know this is an odd question, but I'm wondering if this is possible.
So this might be an odd question, but I have a C# program that
Sorry about the vague question title, but I have these typedefs here: typedef std::list<AnimationKeyframe>
This might be an odd question, but I have form in MVC3 that posts
Odd question, but you have to know first that Facebook API defines all the
I know this is kind of an odd question, but: Inside a textarea, how
This might be odd question but I am just goig to start a new
Well this question may seem odd but it's simple - my point is if
Here's another question about Django. I have this code: views.py cursor = connections['cdr'].cursor() calls

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.