Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Several simple examples of conditional statement and Loop statement in DM7

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Recently, I have initial contact with Dameng database (DM7).

The syntax of SQL is very similar to that of oracle.

-- if statement: if elsif else and if

Declare

P_int int

Begin

P_int: = 1

If pendant int1 then

Print ('AA')

Elsif pendant int2 then

Print ('BB')

Else

Print ('CC')

End if

Exception when others then

Null

End

/

-- Loop writing 1: for loop

Declare

Begin

For i in 1.. 10 loop

Print (I)

End loop

End

/

-- Loop 2: while loop Loop

Declare

Pn number

Begin

Pn: = 10

While pn > 0 loop

Pn: = pn-1

If pn = 5 then

Return

Else

Dbms_output.put_line ('pn:' | | pn)

End if

End loop

End

/

-- 3:loop and loop Loop

Declare

Pn number

Begin

Pn: = 0

Loop

Pn: = pn + 1

Exit when pn > 10

End loop

Dbms_output.put_line ('pn:' | | pn)

End

/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report