Example
Section titled “Example”DECLARE @MyVariable VARCHAR(50)SET @MyVariable = 'Hello, SQL Server!'PRINT @MyVariableOutput
Section titled “Output”Hello, SQL Server!Explanation
Section titled “Explanation”In the example, DECLARE is used to declare a variable @MyVariable of type VARCHAR(50). The SET statement is then used to assign the value ‘Hello, SQL Server!’ to this variable. Finally, the PRINT statement is used to display the value of @MyVariable, which results in outputting ‘Hello, SQL Server!’.
Example
Section titled “Example”BEGIN DBMS_OUTPUT.PUT_LINE('Hello, Oracle!');END;Output
Section titled “Output”Hello, Oracle!Explanation
Section titled “Explanation”In the example, DBMS_OUTPUT.PUT_LINE is an Oracle procedure for sending a message to the console. The message ‘Hello, Oracle!’ is the string provided as an argument to DBMS_OUTPUT.PUT_LINE. The BEGIN and END keywords are used to mark the start and end of the PL/SQL block containing the procedure call.