• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Field definitions when creating a table?

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
(1) i want to create table with a boolean field type - possible?
i thought it would be possible, but i am just having a bit of a headache with the following code...

the error keeps coming up concerning
extra merit BOOLEAN,
it says it is an invalid data type.
do i have to create the table in a PL/SQL block or something?
also, there is a "Bonus" field, in the sense that a bonus is to be calculated ...
i thought of including this code in the actual creation of the table...

but am not sure whether this is necessary at all as it will be calculated. Should i place certain code within the initial definition of the table, so that the bonus field is always created each time the table is viewed?
Or should i not include it in the creation of the table at all?
 
Jasper Vader
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On the google group search area, i found that boolean can be a variable but not a data type, so the following code works for creating my table
create table emp_question
(employee_start_date DATE,
job_type CHAR (1),
extra_merit CHAR(1),
current_salary NUMBER(6,2),
bonus_amount NUMBER(4,2));

cool ... and just put either T or F into the extra_merit field ... i guess a Boolean variable will be able to be derived form that when selecting or whatever?
 
Jasper Vader
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
okay i changed the limit of merit CHAR field to be able to hold 5 characters, so i can put TRUE or FALSE in there ... but i am having trouble assigning the field value to a BOOLEAN variable ... of course .... any ideas on how to do this?
here is what i have done so far...
 
Jasper Vader
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
btw i have inserted some rows in there
 
Jasper Vader
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh it's okay dont worry, i am just going to bring the Char field into a Char var, not a Boolean var.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic