格式: SELECT column FROM table_name START WITH column=value CONNECT BY PRIOR 父主鍵=子外鍵 select lpad(' ',4*(level-1))||name name,job,id,super from emp start with super is null connect by prior id=super 例子: 未經處理資料:select no,q from a_example2 NO NAME -------
複製代碼 代碼如下:select a.f_username from ( SELECT /*+parallel(gu,4)*/distinct gu.f_username FROM t_base_succprouser gu where gu.f_expectenddate > (select trunc(sysdate,'Y')FROM DUAL) and gu.f_lotid=1 and gu.f_playid=4 and gu.f_paymoney>=1500 ) A
1、建立預存程序 create or replace procedure test(var_name_1 in type,var_name_2 out type) as --聲明變數(變數名 變數類型) begin --預存程序的執行體 end test; 列印出輸入的時間資訊 E.g: create or replace procedure test(workDate in Date) is begin dbms_output.putline('The input date is:&
提叻一個程式碼片段,要人協助解釋一下。 程式碼片段如下: 複製代碼 代碼如下: declare type t_indexby is table of number index by binary_integer; type t_nesteed is table of number; type t_varray is varray(10) of number; v_indexby t_indexby; v_nested t_nested; v_varray t_varray; begin
--建立一個表,此表作為子表 create table fk_t as select *from user_objects; delete from fk_t where object_id is null; commit; --建立一個表,此表作為父表 create table pk_t as select *from user_objects; delete from pk_t where object_id is null; commit; --建立父表的主鍵 alter table
複製代碼 代碼如下:using System; using System.Data; using System.Configuration; using System.Data.OracleClient; using System.Text; using System.Windows.Forms; using System.Xml; using Transactions; /// <summary> /// DB 的摘要說明 Written By Luos.Luo ,the
作者:peace.zhao 關於 遊標 if,for 的例子 create or replace procedure peace_if is cursor var_c is select * from grade; begin for temp in var_c loop if temp.course_name = 'OS' then dbms_output.put_line('Stu_name = '||temp.stu_name); elsif temp.course_name = 'DB'
第一種情況是返回的遊標是某個具體的表或視圖的資料,如: SQL-Code: 複製代碼 代碼如下: CREATE OR REPLACE PROCEDURE P_TESTA ( PRESULT OUT SYS_REFCURSOR ) AS BEGIN OPEN PRESULT FOR SELECT * FROM USERS; END P_TESTA; 其中USERS就是資料庫中一個表。在調用的時候只要聲明一個該表的ROWTYPE類型就可以了: SQL-Code: 複製代碼 代碼如下:
example.php複製代碼 代碼如下:<?php $conn = ociplogon("test","123456","test123"); include_once "pager.inc.php"; ?>複製代碼 代碼如下:<?php /** 分頁測試開始 */ // {{{ 初始分頁對象 $pager = new pager(); /** 將 select id,name,age from test where age>20 order by id desc
情境如下:--建立類型(type)create or replace type list_obj is table of number;--建立表結構create table test( name varchar2(30) primary key check(regexp_like(name,'^([a-z]|[0-9]|_)+$')), id number not null, version_list list_obj) nested table version_list store as