I am new to Oracle Forms/Reports. Given this line of code:
Code:
:WHERE_CLAUSE:=' AND TO_DATE(T.TRANS_DATE,'||''''||'MM/DD/YYYY'||''''||') BETWEEN '||''''||:P_FROM_DATE||''''||' AND '||''''||:P_THRU_DATE||'''';
What is up with all of the ticks? I don't understand why that is necessary.
as explained in this
link, in oracle, a single quote ( ' ) is used to define a string literal.
double quotes are used to define a single quote when you need to input a string with a quote character.
for example, '''' as input is equivalent to ' as far oracle is concerned. the double pipe character is used as the concatenation character.
basically, the statement above will equal the following:
Code:
:where_clause := and to_date(t.trans_date,'MM/DD/YYYY')
BETWEEN ':P_FROM_DATE' AND ':P_THRU_DATE';
now, this is plsql code.
the :where_clause,

_from_date and

_thru_date are bind_variables.
but basically, you can see how all the quotes are translated into single quotes. It's not the most pleasant solution and because of that, oracle have introduced an alternative solution for inputing strings with quotes.
Instead of:
select a''''b from dual;
you get:
select q'(a'b bla bla ' ' ' ' ' ' ' ' ' ' ' )' from dual;
the second will print whatever is in the parenthesis. easier to read.