4

Learning about SQL datatypes in PL/SQL. I have a question about what datatype the following expression is:

temp := temp1 < (temp2/ 3);

I'm a bit confused on what datatype this may be. Datatypes can be Numeric, Characters, Boolean, Datetime, and Interval types but this one is throwing me off because of the expressions < and /. This makes me think it's Boolean but I'm not sure.

2 Answers 2

7

It is a boolean. It's equivalent to:

boolean temp;
... 

if (temp1 < (temp2/3) then
  temp := true;
else
  temp := false;
end if;
Sign up to request clarification or add additional context in comments.

Comments

0

Oracle is a little bit complicated in this case. SQL and PL/SQL are interpreted by two distinct engines. Each of them has it's own set of datatypes even if they look similar. Simply VARCHAR2 in SQL is something different from VARCHAR2 in PL/SQL. It gets a little bit more confusing when you start working collections. Also SQL does not have any datatype like BOOLEAN while PL/SQL does. The only exception is SQL function LNNVL which accepts a condition as a parameters, but anyway you can not use literals like "true" or "false" is SQL queries.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.