on-internet
← Community

How do I declare and use variables in PL/SQL like I do in T-SQL?

Stack Overflow ·

In Sql Server, often times when I'm testing the body of a stored procedure, I copy the body into SSMS, DECLARE the variables at the top of the page, set them to some sample values, and execute the body as-is. For Example, if my proc is CREATE PROC MySampleProc @Name VARCHAR(20) AS SELECT @Name Then my test sql would be DECLARE @Name VARCHAR(20) SET @Name = 'Tom' SELECT @Name What is the Oracle PL/SQL equivalent to this? This is the closest that I've come up with, but I'm getting "PLS-00428: an INTO clause is expected in this SELECT statement" DECLARE myname varchar2(20); BEGIN myname := 'Tom';

Comments

Sign in or sign up to comment and upvote.

No comments yet.