Home » SQL & PL/SQL » SQL & PL/SQL » coulmn
coulmn [message #212080] Wed, 03 January 2007 13:25 Go to next message
durai
Messages: 38
Registered: December 2006
Member
i created one table with column
gender char(2);
when is selected the table it shows the column gender as
ge
--
m
f
m
m
..

what shall i do to make it as gender
Re: coulmn [message #212083 is a reply to message #212080] Wed, 03 January 2007 13:43 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
Execute the following before your SELECT:

col gender format a6
Re: coulmn [message #212151 is a reply to message #212083] Thu, 04 January 2007 00:51 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
How many genders are there in your country (so that you need 2 characters, but use only F and M)? ./fa/1626/0/
Re: coulmn [message #212157 is a reply to message #212151] Thu, 04 January 2007 00:57 Go to previous messageGo to next message
Frank
Messages: 7880
Registered: March 2000
Senior Member
Littlefoot wrote on Thu, 04 January 2007 07:51
How many genders are there in your country (so that you need 2 characters, but use only F and M)?

And, to add to the bad design, make it CHAR(2) instead of VARCHAR2, so you will get the pain of trailing spaces for free!
Re: coulmn [message #212221 is a reply to message #212151] Thu, 04 January 2007 04:59 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
Littlefoot wrote on Thu, 04 January 2007 01:51
How many genders are there in your country (so that you need 2 characters, but use only F and M)?

That was my initial thought too Littlefoot. However, I was once on a project that officially recognized like 10 different genders. Can't remember what they all were, but it was surprising nonetheless.
Re: coulmn [message #212230 is a reply to message #212221] Thu, 04 January 2007 05:25 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
10 different genders?!? I'd really like to see which ones they used and for what purpose! Were they human genders or ... I don't know, corn genders, goldfish genders, Alpha Centauri solar system inhabitants genders ...?

So, if you can't sleep at night, think about it and post (some of) them here. I believe this isn't necessary, but ... its urgnt plz!
Re: coulmn [message #212234 is a reply to message #212230] Thu, 04 January 2007 05:30 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Littlefoot wrote on Thu, 04 January 2007 12:25
10 different genders?!? I'd really like to see which ones they used and for what purpose! Were they human genders or ... I don't know, corn genders, goldfish genders, Alpha Centauri solar system inhabitants genders ...?
We had once on a project a column 'Gender' containing something like this:
AM = Adult Male
AF = Adult Female
CM = Child Male
CF = Child Female
IM = Infant Male
...

MHE
Re: coulmn [message #212240 is a reply to message #212230] Thu, 04 January 2007 05:35 Go to previous messageGo to next message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
LOL...I'll see if I have any of the old documentation that referenced the various categories.
Re: coulmn [message #212249 is a reply to message #212240] Thu, 04 January 2007 06:02 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Please, Brian, do so. As it is urgnt.

Maarten, I don't know what was this project about, but being an "infant male" isn't really normalized. As that infant grows, its gender changes - first to child, then ... whatever follows. So, what was business rule: schedule a job which would - on daily basis - decide who isn't a child any more or who is about to die any moment or ... and update that column?

I'd, somehow, rather see their gender set to M and F (or preferred letters in someone's native tongue), while "infant" or "child" would be a matter of SYSDATE - Date_of_birth calculation.
As you can see, I have some spare time at the moment ./fa/1597/0/.
Re: coulmn [message #212269 is a reply to message #212249] Thu, 04 January 2007 08:00 Go to previous messageGo to next message
ThomasG
Messages: 3189
Registered: April 2005
Location: Heilbronn, Germany
Senior Member
Ahhh, but only if the AM/AF/CM/CF/IM/IF is connected to actual persons. It could also be it's connected to gender-specific items like clothing or something, so it wouldn't change.

But I would say from experience I can see *one* definite circumstance where additional genders would come up sometime almost certainly : When you are told in the design phase or the app that it is 100% shure that there will only be 2 genders. Wink

Re: coulmn [message #212294 is a reply to message #212269] Thu, 04 January 2007 09:55 Go to previous message
durai
Messages: 38
Registered: December 2006
Member
i got the answer of this question, thanx to all for ur kind reply, actually my doubt is regarding the display of the column gender
initially when is use
select * from empgender;
ge
--
m
m
f
f


but when i made changes
col gender format a6
it works properly
select * from empgender;
gender
------
m
m
f
f

once again thanx to every body
Previous Topic: Neither LPAD nor RPAD - is there a middle? (merged)
Next Topic: Execute SQL Saved in Table
Goto Forum:
  


Current Time: Thu Dec 08 18:32:19 CST 2016

Total time taken to generate the page: 0.23318 seconds