SpruceMoose SpruceMoose - 1 month ago 11
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."

http://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_7002.htm


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

Leo Leo
Answer

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