SQL Statement
Data explorer zones are used to select data to display using one or more SQL statements. The SQL parameters are applicable to the following zone types
Info Data Explorer - Single SQL (F1–DE-SINGLE). The parameter has the description SQL Statement.
Info Data Explorer - Multiple SQLs (F1–DE). The parameters follow the description pattern of SQL Statement x.
Query Data Explorer - Multiple SQLs (F1–DE-QUERY). The parameters follow the description pattern of SQL Statement x.
Note:
If your implementation has been configured to restrict the functions that may be used when defining an SQL then an error is issued at runtime if there are functions found that are not in the allowlist. The allowlist may be viewed using the View SQL function allowlist link in the Tips zone on the zone maintenance page.
The following table provides a list of SQL substituted keywords that may be used in the SQL Statement parameters in explorer zones. At execution time, the system determines the database and substitutes the keyword with the database specific syntax:
Keyword
Description
Examples
@toCharacter()
Converts the input to Character data type.
select @toCharacter(batch_​cd) as batchCode from ci_​batch_​ctrl
@toDate()
Converts the input to Date data type.
select @toDate(last_​update_​dttm) as lastUpdateDate from ci_​batch_​ctrl
@toNumber()
Converts the input to Number data type.
select @toNumber(next_​batch_​nbr) from ci_​batch_​ctrl
@currentDate
Fetches the current date.
CAUTION:
The Oracle functions SYSDATE and CURRENT_​DATE should not be used because they do not properly cater for adjusting dates from the database time zone to the installation time zone, if needed.
select batch_​cd, @currentDate as today from ci_​batch_​ctrl
@currentTimestamp
Fetches the current date / time.
CAUTION:
The Oracle functions SYSTIMESTAMP and CURRENT_​TIMESTAMP should not be used because they do not properly cater for adjusting the date / time from the database time zone to the installation time zone, if needed.
select batch_​cd from ci_​batch_​ctrl where last_​update_​dttm > @currentTimestamp
@concat
Combines the result list of two or more columns.
select batch_​cd @concat next_​batch_​nbr concatNbr from ci_​batch_​ctrl
@substr(string, start)
String is the input String that you are trying to get a substring of.
Start is the position of the character for the output results.
select batch_​cd batchCode from ci_​batch_​ctrl
Result: TESTCD
select @substr(batch_​cd,3) batchCode from ci_​batch_​ctrl
Result: STCD
@substr(string, start, end)
String is the input String that you are trying to get a substring of.
Start is the position of the character for the output results.
End is the number of characters required in the output from starting position.
Select batch_​cd batchCode from ci_​batch_​ctrl
Result: TESTCD
select @substr(batch_​cd,3,2) batchCode from ci_​batch_​ctrl
Result: ST
@trim
Trims the white spaces of the output on both sides.
select @trim(batch_​cd) as batchCode from ci_​batch_​ctrl
The following syntax is related to ‘fuzzy’ searching. It is only applicable if Oracle DB Text is enabled and a context text index has been created. Refer to Advanced Search Options for more information.
@fuzzy(string, score, numresult, ‘weight’)
String is the input value for the search.
Score is the degree of ‘fuzziness’. Valid values are between 1 - 80. The higher the number the more precise the search. Default is 60.
Numresults is the number of variations to consider for the string. Valid values are between 1 and 5000. Default is 100.
Indicate ‘weight’ to signal that the results are returned in order of weight. Leave this setting off to indicate that the results are returned in order of score.
Set score to 70, number results to 6, and specify weight.
select user_​id, last_​name from sc_​user where contains(last_​name, @fuzzy(:F1,70, 6, 'weight')) > 0
@fuzzy(string)
This returns a string result from the fuzzy expansion operation where the default value of 60 is assumed for the score and the default value of 100 is assumed for the numresult.
To use default values:
select user_​id, last_​name from sc_​user where contains(last_​name, @fuzzy(:F1))> 0
@fuzzy(string, score)
This returns a string result from the fuzzy expansion operation with the score specified and the default value of 100 for the numresult.
Set score to 70.
select user_​id, last_​name from sc_​user where contains(last_​name, @fuzzy(:F1,70)) > 0
@fuzzy(string, score, numresult)
This returns a string resulted from the fuzzy expansion operation with the similarity score and the numresults specified.
Set score to 70, number results to 6.
select user_​id, last_​name from sc_​user where contains(last_​name, @fuzzy(:F1,70, 6)) > 0