SpruceMoose SpruceMoose - 3 months ago 25
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

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