Collections:
Invoke Built-in Functions in PL/SQL in Oracle
How To Invoke Built-in Functions in PL/SQL in Oracle?
✍: FYIcenter.com
Of course, you can invoke SQL functions in SQL statements. But many SQL functions can also be executed in regular PL/SQL statements, as shown in the following sample script:
DECLARE now DATE; id NUMBER; str VARCHAR2(40); BEGIN now := SYSDATE; DBMS_OUTPUT.PUT_LINE('Time #1 = ' || TO_CHAR(now,'HH24:MI:SS')); SELECT SYSDATE INTO now FROM DUAL; DBMS_OUTPUT.PUT_LINE('Time #2 = ' || TO_CHAR(now,'HH24:MI:SS')); id := UID; DBMS_OUTPUT.PUT_LINE('User id #2 = ' || TO_CHAR(id)); SELECT UID INTO id FROM DUAL; DBMS_OUTPUT.PUT_LINE('User id #2 = ' || TO_CHAR(id)); str := CHR(70)||CHR(89)||CHR(73); DBMS_OUTPUT.PUT_LINE('String #1 = ' || str); SELECT CHR(70)||CHR(89)||CHR(73) INTO str FROM DUAL; DBMS_OUTPUT.PUT_LINE('String #2 = ' || str); END; / Time #1 = 21:41:16 Time #2 = 21:41:16 User id #2 = 33 User id #2 = 33 String #1 = FYI String #2 = FYI
⇒ Retrieve the Count of Updated Rows in Oracle
⇐ Error: Exact Fetch Returns More Rows in Oracle
2018-09-13, 1705🔥, 0💬
Popular Posts:
Where to find answers to frequently asked questions on Conditional Statements and Loops in SQL Serve...
What Is an Oracle Tablespace in Oracle? An Oracle tablespace is a big unit of logical storage in an ...
How To Disable a Login Name in SQL Server? If you want temporarily disable a login name, you can use...
Where to find answers to frequently asked questions on Storage Engines: MyISAM, InnoDB and BDB in My...
How To Insert New Line Characters into Strings in SQL Server Transact-SQL? If you want to break a st...