SQL Function Calls from PL/SQL
Most SQL functions are supported for calls directly from PL/SQL.
In this first example, the function RTRIM
is used as a PL/SQL function in a PL/SQL assignment statement.
Command> DECLARE p_var VARCHAR2(30);
BEGIN
p_var := RTRIM ('RTRIM Examplexxxyyyxyxy', 'xy');
DBMS_OUTPUT.PUT_LINE (p_var);
END;
/
RTRIM Example
PL/SQL procedure successfully completed.
In this next example, for comparison, RTRIM
is used as a SQL function in a static SQL statement.
Command> DECLARE tt_var VARCHAR2 (30);
BEGIN
SELECT RTRIM ('RTRIM Examplexxxyyyxyxy', 'xy')
INTO tt_var FROM DUAL;
DBMS_OUTPUT.PUT_LINE (tt_var);
END;
/
RTRIM Example
PL/SQL procedure successfully completed.
You can refer to information about SQL functions in TimesTen under Expressions in Oracle TimesTen In-Memory Database SQL Reference. See SQL Functions in PL/SQL Expressions in Oracle Database PL/SQL Language Reference.