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

PL/SQL 学习笔记3

 SQL> var a number
SQL> begin
2 :a :=1000;
3 end;
4 /
PL/SQL procedure successfully completed.
SQL> edit
Wrote file afiedt.buf
1 begin
2 dbms_output.put_line(:a);
3* end;
SQL> /
通过这个代码可以看出通过pl/sql初始化赋值的Bind variable可以被其他Pl/sql程序调用
%type 类型应用的话 如果前面用的是database column的话 那么不可以加not null,前面引用的是声明的变量可以应用not null
A NOT NULLdatabase column constraint does not apply to variables that are declared using %TYPE.  
Therefore, if you declare a variable using the %TYPEattribute that uses a database column defined as NOT  
NULL, you can assign the NULLvalue to the variable.  
eg:
绑定变量
A bind variable is a variable that you declare in a host environment.
 Bind variables can be used to pass run-time values, either number or character, into or out of one or more PL/SQL programs. The PL/SQL  
programs use bind variables as they would use any other variable. You can reference variables declared in the  
host or calling environment in PL/SQL statements, unless the statement is in a procedure, function, or  
package. This includes host language variables declared in precompiler programs, screen fields in Oracle   Developer Forms applications, and iSQL*Plus bind variables.
绑定变量可以在主机环境下声明 可以在sqlplus 这种应用程序下声明 然后pl/sql程序来调用 调用需要在该变量前加colon
赋值的时候可以使用 exec :var_name := 10000; or begin :var_name := 1000 end; 或者是在PL/SQL中赋值
print(sqlplus command)可以打印出这个值
SQL> var result number
SQL> begin
2 select (sal*12) + nvl(comm,0)
3 into :result
4 from emp
5 where empno = 7369;
6 end;
7 /
PL/SQL procedure successfully completed.
SQL> print result
RESULT
------
9600
SQL> exec :result = 10000
BEGIN :result = 10000; END;
*
ERROR at line 1:
ORA-06550: line 1, column 15:
PLS


相关文档:

清除SQL SERVER 数据库日志

  1.清空日志  
  DUMP     TRANSACTION     库名     WITH     NO_LOG          
   
  2.截断事务日志:  
  BACKUP   LOG   数据库名   WITH   NO_LOG  
    ......

Linq to sql增删改查

private void button2_Click(object sender, EventArgs e)//增
{
try
{
Customers ct = new Customers();
ct.CustomerID = "test";
ct.CompanyName = "test";
NorthwindDataContext nc = new NorthwindDataContex ......

sql手工注入

SQL手工注入大全
2006年08月11日 星期五 21:00
比方说在查询id是50的数据时,如果用户传近来的参数是50 and 1=1,如果没有设置过滤的话,可以直接查出来,SQL 注入一般在ASP程序中遇到最多,
看看下面的
1.判断是否有注入
;and 1=1
;and 1=2
2.初步判断是否是mssql
;and user>0
3.判断数据库系统
;and ......

SQL 2005 存储过程分页

create PROCEDURE [dbo].[P_PageTest]
    @SQL Nvarchar(max),  --SQL语句不包括排序
    @CurPage int,    --当前页
    @PageRows int,    --页面尺寸
 @Order Nvarchar(20),  --排序字段
 @OrderType Nvarchar( ......

PL/SQL 学习笔记2

变量声明
Syntax:
identifier [CONSTANT] datatype [NOT NULL]   [:= | DEFAULT expr];
SQL> declare
2 a date;
3 b number(20) not null :=100;
4 c varchar2(10);
5 d constant number(20) default 1000;
6 begin
7 null;
8 end;
9 /
PL/SQL procedure successful ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号