Oracle Write declare example

Source: Internet
Author: User

Attention:

1. Assign Value: =

2. Or the relationship is represented by or

Declare

Prefix VARCHAR2 (2); --Prefix

Res_value VARCHAR2 (20);

Begin

Prefix: = ' QZ ';

For I in (select Col1,col2 from table_name) loop

If i.col1= ' col1 ' or i.col2= ' col2 ' then
Res_value: = ' 123456 ';
End If;

End Loop;

Res_value: = SUBSTR (res_value,0,2); --intercepts the string starting from the first bit (0 and 1 representing the first digit) to intercept 2

Dbms_output.put_line (Res_value); --Output statement

End

Final Output "12"

Oracle Write declare example

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.