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

PL/SQL集锦

--设置数据库输出,默认为关闭,每次新打开窗口都要重新设置
set serveroutput on
--调用     包           函数    参数
execute dbms_output.put_line('hello world');
--或者用call调用,相当于java中的调试程序打桩
call dbms_output.put_line('hello world');
--pl语句块是pl/sql里最小的编程块,其中可以再嵌套begin end
begin
 dbms_output.put_line('Hello World');
 dbms_output.put_line('2*3='||(2*3));
 dbms_output.put_line('what''s');
end;
--如何声明变量,所有变量必须再declare中声明,程序中不允许声明
--没有初始化的变量默认值为null,屏幕上null是看不见的,命名习惯:一般变量以v_开头
--注意number也能存小数,最长38位,所以以后建议整数都用binary_integer存
--long是字符类型,boolean类型补能打印
--标准变量类型:数字,字符,时间,布尔
declare
 v_number1 number ;
 v_number2 number(3,2) ;
 v_number3 binary_integer :=1;
 v_name varchar2(20) :='kettas';
 v_date date :=sysdate;
 v_long long :='ni hao';
 v_b boolean := true;
begin
 if (v_number1 is null) then
  dbms_output.put_line( 'hello');
 end if;
 dbms_output.put_line(v_number1);
 dbms_output.put_line(v_number2);
 dbms_output.put_line(v_number3);
 dbms_output.put_line(v_name);
 dbms_output.put_line(v_date);
 dbms_output.put_line(v_long);
    --dbms_output.put_line(v_b);
end;
/
--组合类型:record table
--record类型最常用,声明的时候可以加not null,但必须给初始值
--如果record类型一致可以相互赋值,如果类型不同,里面的字段恰好相同,不能互相赋值
declare
       type t_first is record(
            id number(3),
            name varchar2(20)
       );
       v_first t_first;
begin
     v_first.


相关文档:

SQL 获取列名 利用系统表

SELECT sysobjects.name,syscolumns.name
from  sysobjects,syscolumns
WHERE(sysobjects.id=syscolumns.id)
select col_name(OBJECT_ID('staff'),17)
select name
from syscolumns
where id=object_id('你的表名'); ......

sql case select

SELECT ID,TITLE,
(SELECT TIMES from CLS_COURSE WHERE CLS_COURSE.ID=CLS_CLASS.COURSEID) AS TIMES,
(SELECT CASE WHEN EXISTS(SELECT *  from CLS_ATDC WHERE CLS_ATDC.CLSID=CLS_CLASS.ID ) THEN (SELECT TOP 1 COURSETIME from CLS_ATDC WHERE CLS_ATDC.CLSID=CLS_CLASS.ID ORDER BY COURSETIME DESC) ELSE 0 ......

ASP.NET连接SQL和ACCESS的方法

SQL:
using System.Data.SqlClient;
string sql = "server=.;uid=sa;pwd=;database=tablename;";
ACCESS:
using System.Data.OleDb;
string sql = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=" + HttpRuntime.AppDomainAppPath + "//App_Data//db.mdb";
HttpRuntime.AppDomainAppPath 为根目录
......

如何用SQL语言选择表中的第二条第三条第N条记录

如何用SQL语言选择表中的第二条第三条第N条记录
--ID为唯一性就行了
select top 1 * from table
where ID not in(select top 1 ID from table)--第2条
select top 1 * from table
where ID not in(select top 2 ID from table)--第3条
......

Auto process Cube with SQL Agent job

(1)     Connect to the Analysis server, select the database which we want it to be automatically processed. Right click on this database, choose ‘Process’:
(2)     In the opening ‘Process database’ form, click the ‘Script Action ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号