oracle中怎么写语句

1.请教,Oracle中的语句写法~~~create table wcy_t1(ID number,InputTime date);insert into wcy_t1 values(1 ,to_date('2011-04-18 00:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(2 ,to_date('2011-04-18 01:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(3 ,to_date('2011-04-18 02:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(4 ,to_date('2011-04-18 03:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(5 ,to_date('2011-04-18 04:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(6 ,to_date('2011-04-18 05:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(7 ,to_date('2011-04-18 06:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(8 ,to_date('2011-04-18 08:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(9 ,to_date('2011-04-18 10:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(10 ,to_date('2011-04-18 11:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(11 ,to_date('2011-04-18 12:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(12 ,to_date('2011-04-18 14:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(13 ,to_date('2011-04-18 15:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(14 ,to_date('2011-04-18 16:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(15 ,to_date('2011-04-18 17:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(16 ,to_date('2011-04-18 18:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(17 ,to_date('2011-04-18 19:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(18 ,to_date('2011-04-18 20:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(19 ,to_date('2011-04-18 21:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(20 ,to_date('2011-04-18 22:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(21 ,to_date('2011-04-18 23:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(22 ,to_date('2011-04-19 00:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(23 ,to_date('2011-04-19 01:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(24 ,to_date('2011-04-19 02:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(25 ,to_date('2011-04-19 05:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(26 ,to_date('2011-04-19 06:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(27 ,to_date('2011-04-19 07:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(28 ,to_date('2011-04-19 08:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(29 ,to_date('2011-04-19 10:00:00','yyyy-mm-dd hh24:mi:ss'));insert into wcy_t1 values(30 ,to_date('2011-04-19 11:00:00','yyyy-mm-dd hh24:mi:ss'));create or replace view v$test as select inputtime start_time,( select min(inputtime) from wcy_t1 f2 where not exists ( select 1 from wcy_t1 f3 where trunc(f3.inputtime,'hh24')=trunc(f2.inputtime,'hh24')+1/24) and f2.inputtime>=f1.inputtime) end_time from wcy_t1 f1;select * from v$test;select to_char(min(start_time),'yyyy-mm-dd hh24:mi:ss')||' 至 '||to_char(end_time,'yyyy-mm-dd hh24:mi:ss') from v$test group by end_time order by end_time; 。
2.关于oracle中的sql语句的写法1. select a.no from A a inner join (select * from B unin select * from C) b on a.no=b.no where a.name!=b.name
2. select no from A a where no not in(select no from B unin select no from C) unin select no from (select no from B unin select no from C) where no not in (select no from A)
3.oracle中判断语句怎么写是存储过程里面的 IF/ELSE ? 还是简单的 DECODE ?
SQL> DECLARE
2 testvalue INT;
3 BEGIN
4 testvalue := 100;
5
6 IF testvalue > 100 THEN
7 dbms_output.put_line( '100+' );
【oracle中怎么写语句】8 ELSIF testvalue = http://www.xuexi88.com/zhishi/100 THEN
9 dbms_output.put_line( '100' );
10 ELSE
11 dbms_output.put_line( '100-' );
12 END IF;
13
14 END;
15 /
100
PL/SQL procedure successfully completed.
SQL> SELECT
2 DECODE(GROUPING(sale_item), 1, 'ALL', sale_item) AS iten,