discord1 discord1 - 6 months ago 17x
SQL Question

adding a length of time when creating table in oracle sql

ive been asked to create a table that includes

Entry time (m.sshh) eg. 0.3506 (store as a number)
Final time (m.sshh) eg. 0.3506 (store as a number)

how do I format this when I create the table? I've tried

reg_code varchar(5),
event_no number(1,50),
entry_time number (m.sshh),
final_time number (m.sshh)

but I get a "numeric precision specifier is out of range (1 to 38)" error. I also get a missing right parenthesis error when I use to_char.



The basic answer is: do not store them as numbers.

You are looking for Interval Literals, especially the DAY TO SECOND type ones.

Please read the linked documentation, you should get why it fits you needs.