ORACLE PL/SQL Exercise (eight)

Source: Internet
Author: User

Replace variables with bound variables:

sql> define x= ' abc '--Defining variables

Sql> define X

DEFINE X = "abc" (CHAR)


sql> select ' &x ' from dual; --Query substitution variable value

Old 1:select ' &x ' from dual

New 1:select ' abc ' from dual


' AB

---

Abc


sql> variable x varchar2 (10)--Declaring variables

Sql> begin

2:x: = ' Hello ';

3 END;

4/


PL/SQL procedure successfully completed.


Sql> print:x--Print bound variable values


X

--------------------------------

Hello


Sql> select:x, ' &x ' from dual; --Query bound variable and substitution variable value

Old 1:select:x, ' &x ' from dual

New 1:select:x, ' abc ' from dual


: X ' AB

-------------------------------- ---

Hello ABC


Note: Define variables are always sql*plus extended strings, and the declare variable can be used by SQL and PL $ as a true binding variable.


This article from "Technology Station" blog, declined reprint!

ORACLE PL/SQL Exercise (eight)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.