易截截图软件、单文件、免安装、纯绿色、仅160KB

PL/SQL语言简介

一、    PL/SQL语言简介
(本讲义之所有程序均调式通过)
首先我们看一个简单之例子,下面这个例子是统计从1至100的总和.
declare
i number:=0;          /*声明变量井给初值*/
t number:=1;
error_message exception;  /*声明一个出错处理*/
begin
  for t in 1..100 loop
    i:=i+t;
  end loop;
  if i>=5050 then
    raise error_message;  /*引发错误处理*/
  else
    insert into c_nt(c_t) values(i);
  end if;
exception
  when error_message then
  insert into c_nt(c_t) values(0);
end;
²      从上例中可以看出PL/SQL语法的一般规则.
­              PL/SQL中语句以分号(;)结尾.
­              开始程序块的PL/SQL语句(如IF…或BEGIN语句)没有分句.
­              文本值括在单引号(‘ ‘)内,而不是(“ “).
­              过程只允许最后有一个出口..
²      PL/SQL程序可以分为三个部分
­             DECLARE部分用于变量、常量、函数、过程、Cursor.
­             BEGIN部分包含PL/SQL块中要执行的代码 用于程序处理,其中可以调用函数、过程.
­             Exception 部分用于出错处理.
下面我们再看一个例子:
declare
i number :=1;
t number :=1;
p number :=1;
/*create table c_ny(c_t number,cou_t number);*/
function aa(xx number)return number is     /* define function*/
   tt number;
   ct number:=1;
    j number:=1;
begin
   while


相关文档:

SQL跨用户取进行数据库操作(这里用到了left join)

select ks.login_name,ks.exam_name,ks.start_time,ks.end_time,cj.score
from (
     select u.user_id,u.login_name,e.* from  cphrms.EXAM_USER eu, cphrms.users u, cphrms.exam_info e
     where eu.user_id = u.user_id and eu.exam_id = e.exam_id
) ks
left ......

SQL高级应用 Garin Zhang

追加:row_number, rank, dese_rank, ntile
1. row_number: 为查询出来的每一行记录生成一个序号。
SELECT row_number() OVER(ORDER BY field) AS row_n
from tablename;
分页查询:
with t_towtable
as (select row_number over(order by field1) as row_number from tb)
select * from t_rowtable where row_numbe ......

1.什么叫SQL注入?如何防止?请举例说明

1.什么叫SQL注入?如何防止?请举例说明
答:SQL注入是常见的利用程序漏洞进行攻击的方法。导致sql注入攻击并非系统造成的,主要是程序中忽略了安全因素,利用sql语言漏洞获得合法身份登陆系统 
例如:
"Select * from users where name='"+uName+"' and pwd='"+uPwd+"' " ......

在Eclipse中用JDBC连接Sql Server 2005总结

* 最近因为开发活动需要,用上了Eclipse,并要求使用精简版的SQL(即 2005)来进行开发项目 * 
1.准备工作: 准备相关的软件(Eclipse除外,开源软件可以从官网下载) 
<1>.Microsoft 2005 Express Edition 
下载地址:http://download.microsoft.com/download/0/9/0 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号