SpruceMoose SpruceMoose - 1 year ago 72
SQL Question

Oracle DEFAULT clause for create table. "Literal argument"?

I was just reading the documentation for the CREATE TABLE statement and it says this in relation to the DEFAULT clause:

"The DEFAULT expression can include any SQL function as long as the
function does not return a literal argument, a column reference, or a
nested function invocation."


What does it mean by the function cannot return a "literal argument". I thought returning literals was OK for DEFAULT?

Leo Leo
Answer Source

Yes, it is OK to use literals with DEFAULT, for example DEFAULT 'YES' . What is telling you that text is that if you are using a function in DEFAULT, for example DEFAULT POWER(2,3) , that function POWER must not return a literal argument. You can use SQL built in functions in the clause DEFAULT , but not USER defined PLSQL functions

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download