//数据类型的说明,不区分大小写
String name="xmddl"
Integer i
Real s //这里为单行注释
Integer a[1 to 10]
real i_s[4]={1,2,3,4}
CONSTANT String j="HELLO"
real ii_s[2,4]={1,1,1,1,2,2,2,2}
string s_s[2,3,4]
dec{2} fj
dec jj,ii
double d
/*
这里为多行注释
fdsfsdfds
*/
time mytime
date mydate=2006-07-07
datetime mydatetime
char c='w'
string hello="it~'s a dog"//it's a dog
any my,you,he
blob bk
boolean b
long l
int iss
ResultSet rs
resultsets rss //不区分大小写
//运算符
/*
1、算术运算符:*、/、+、-、^
2、逻辑运算符:NOT、AND、OR
3、关系运算符:=、>=、>、<、<=、<>
4、连接运算符:&
*/
jj+=jj+ii
jj=jj/ii
jj=jj*ii
jj -=ii
jj +=ii
//程序控制语句:选择、循环、其他语句
if jj>ii then
//todo......
end if
if jj>ii then
//todo...
elseif jj=ii then
//todo...
end if
string sss_s
sss_s = create using "string"
transaction DBTrans
DBTrans=create transaction
DBTrans.autocommit=false
DESTROY DBTrans//销毁create创建的对象,open创建可视化对象
CHOOSE CASE jj
CASE 1
//TODO...
CASE 2
//TODO...
CASE ELSE
//TODO...
END CHOOSE
/*(循环判断)
.... DO UNTIL condition …LOOP
.... DO WHILE condition … LOOP
.... DO … LOOP UNTIL condition
.... DO … LOOP WHILE condition
FOR varname = start TO end [STEP increment]
statementblock
NEXT
*/
SQLCA.dbms="localhost"
//SQLCode=0成功,SQLCode=-1失败,SQLCode=100SQL语句没有返回数据
CONNECT USING SQLCA;
DECLARE EMP_cur CURSOR FOR
select employee.fname
from employee
where employee.job_id =:i;
OPEN EMP_cur;
FETCH EMP_cur INTO :sss_s;
CLOSE EMP_cur;
select employee.fname into :sss_s //嵌入sql编程,pb的特色
from employee
where employee.job_id =:i
using DBTrans;
if DBTrans.sqlcode=0 then
//todo...
COMMIT USING DBTrans;//事务提交
else
//toto...
ROLLBACK USING DBTrans;//事务回滚
end if
DISCONNECT USING SQLCA;
(1)、HALT、HALT(CLOSE)
(2)、RETURN
(3)、CREATE
(4)、DESTROY
语句不以分号结束