What is "=>" used for in PL/SQL?
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
It is used to identify a value for a parameter name. Here's an example:
CREATE PROCEDURE my_proc (parm1 IN varchar2, parm2 IN date DEFAULT sysdate, parm3 IN number) AS . . . code for this procedure would go here. . .Now, when you want to call this procedure in a PL/SQL code block, you'd call it as follows:
begin my_proc('XYZ', to_date('12/12/2002','mm/dd/yyyy'), 123) ; end; /But, what if you wanted to call the procedure and not pass the second parameter (parm2 IN date) and simply allow it to use the default of sysdate which you specified in the procedure parameter definition. This is how you'd do it:
begin my_proc(parm1 => 'XYZ', parm3 => 123) ; end; /So... "=>" is used to assign the value indicated to the named parameter. You can use this syntax every time you call the procedure for clarity and to "self-document" your code as well.
For More Information
- Dozens more answers to tough Oracle questions from Karen Morton are available.
- The Best Oracle Web Links: tips, tutorials, scripts, and more.
- Have an Oracle or SQL tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize. Submit your tip today!
- Ask your technical Oracle and SQL questions -- or help out your peers by answering them -- in our live discussion forums.
- Ask the Experts yourself: Our SQL, database design, Oracle, SQL Server, DB2, metadata, object-oriented and data warehousing gurus are waiting to answer your toughest questions.
Dig Deeper on Using Oracle PL-SQL
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.