Search code examples
oracle11goraclereports

bind parameter inside a lexical parameter oracle reports builder


Is there a way to use a bind parameter inside a lexical parameter query something like this?:

select col from tbl where col = :bind_param

note: the code above is an input in a lexical parameter


Solution

  • When saying a "lexical query", do you mean a "lexical parameter"?

    If I understood you correctly, then yes - you can do that, by setting it in the After Parameter Form trigger. (BTW, that's where I set my lexical parameters' values, always).

    Open Reports Online Help System and search for "lexical". It is very well described. I believe that this is what you are asking:

    A lexical reference cannot be used to create additional bind variables after the After Form trigger fires. For example, suppose you have a query like the following (note that the WHERE clause is replaced by a lexical reference):

    SELECT ENAME, SAL FROM EMP
      &where_clause
    

    If the value of the where_clause parameter contains a reference to a bind variable, you must specify the value in the After Form trigger or earlier (*LF). You would get an error if you supplied the following value for the parameter in the Before Report trigger:

    WHERE SAL = :new_bind
    

    If you supplied this same value in the After Form trigger, the report would run.

    (*LF) Now, that's somewhat contradictory - "or earlier" actually is the Before Report trigger, so ... take it with caution. As I've said (and I'll repeat it): I set lexical parameters' values in the After Parameter Form. Worked always (for me).