Oracle Split¹¦Äܺ¯Êý
ÔÚpl/sqlʱ¾³£»áÅöµ½½«Ä³Ð©Ìض¨µÄ·ûºÅת»»³ÉÐÐ,Õ⹦ÄÜÏ൱ÓÚsplit.ÒÔÇ°ÔÚÍøÉÏÊÕ¼¯µÄsplitº¯ÊýÈçÏÂ:
CREATE OR REPLACE TYPE DJ_STR_SPLIT IS TABLE OF VARCHAR2 (4000);
CREATE OR REPLACE PACKAGE Dj_Function_API IS
module_ CONSTANT VARCHAR2(25) := 'FNDBAS';
lu_name_ CONSTANT VARCHAR2(25) := 'DjFunction';
Function Get_Split_Change(
str_ IN VARCHAR2,
delimiter_ IN VARCHAR2:=';')
Return Dj_Str_Split;
END DJ_FUNCTION_API;
/
------------------------------------------------------------------------
------------------------------------------------------------------------
------------------------------------------------------------------------
CREATE OR REPLACE PACKAGE BODY Dj_Function_API IS
---------------------------Get_Split_Change------------------------------------
Function Get_Split_Change(
str_ IN VARCHAR2,
delimiter_ IN VARCHAR2:=';')
RETURN Dj_Str_Split
IS
j INT := 0;
i INT := 1;
len INT := 0;
len1 INT := 0;
str VARCHAR2 (4000);
str_split Dj_Str_Split :=Dj_Str_Split();
BEGIN
len := LENGTH (str_);
len1 := LENGTH (delimiter_);
WHILE j < len
LOOP
j := INSTR (str_, delimiter_, i);
IF j = 0
THEN
&n
Ïà¹ØÎĵµ£º
ËäȻѧϰJavaºÜ¾ÃÁË£¬×Ô¼ºÒ²Á¬½Ó¹ýһЩÊý¾Ý¿â£¬±ÈÈçmysqlÖ®ÀàµÄ£¬Èç½ñÄØ£¬Ò²Ñ§Ï°ÁËÒ»¶Îʱ¼äµÄOracle£¬È»¶øÄØ£¬½ñÌìÊÇÎÒµÚÒ»´ÎÁ¬½ÓOracle£¬ºÙºÙ£¬Ó¦¸Ã»¹²»ËãÌ«³Ù°É¡£
½ñÌìÄØ£¬Óе㱿׾£¬´ó¼ÒĪЦ£¡
ÎÒÕâÊÇÒ»¸ö²éѯÀý×Ó
Ê×ÏÈ£¬Ô ......
declare
sqlstring varchar2(100);
emprow emp_bak%rowtype;
myno emp_bak.empno%type;
begin
--sqlstring:='create table emp_bak as select * from emp';
sqlstring:='select * from emp_bak where empno=:myno and sal>:mysal';
myno:='&ÇëÊäÈëÔ±¹¤±àºÅ';
--¶¯Ì¬SQ ......
GROUPINGº¯Êý¿ÉÒÔ½ÓÊÜÒ»ÁУ¬·µ»Ø0»òÕß1¡£Èç¹ûÁÐֵΪ¿Õ£¬ÄÇôGROUPING()·µ»Ø1£»Èç¹ûÁÐÖµ·Ç¿Õ£¬ÄÇô·µ»Ø0¡£GROUPINGÖ»ÄÜÔÚʹÓÃROLLUP»òCUBEµÄ²éѯÖÐʹÓᣵ±ÐèÒªÔÚ·µ»Ø¿ÕÖµµÄµØ·½ÏÔʾij¸öֵʱ£¬GROUPING()¾Í·Ç³£ÓÐÓá£
¹ØÓÚROLLUPºÍCUBEº¯ÊýµÄʹÓã¬Çë²Î¼ûÎÒµÄÁíһƪÎÄÕ¡£
http://blog.csdn.net/wh62592855/archive/2009/1 ......
´Óoracle 9i ¿ªÊ¼£¬ÌṩÁËÒ»¸ö½Ð×ö“¹ÜµÀ»¯±íº¯Êý”µÄ¸ÅÄ¿ÉÒÔÀûÓùܵÀ»¯À´·µ»Ø±íº¯Êý¡£
µ«ÕâÖÖÀàÐ͵ĺ¯Êý£¬±ØÐë·µ»ØÒ»¸ö¼¯ºÏÀàÐÍ£¬ÇÒ±êÃ÷ pipelinedÒÔ¼°²»ÄÜ·µ»Ø¾ßÌå±äÁ¿£¬¶øÊÇÒÔÒ»¸ö¿Õ return ·µ»Ø!
Õâ¸öº¯ÊýÖУ¬Í¨¹ý pipe row () Óï¾äÀ´ËͳöÒª·µ»ØµÄ±íÖеÄÿһÐÐ
ÔÚµ÷ÓÃÕâ¸öº¯ÊýµÄʱºò£¬Í¨¹ý table() ¹Ø¼ ......
ÔÚÊý¾Ý¿âÖо³£ÒªºÏ²¢×Ö·û´®£¬¶øºÏ²¢×Ö·û´®µÄ·½·¨Óкܶ࣬ÏÖÔÚ×ܽáÈçÏ£º
--´´½¨»á»°¼¶ÁÙʱ±í
create global temporary table TMPA
(
ID INTEGER,
NAME VARCHAR2(10)
)
on commit preserve rows;
--²åÈë¼Ç¼
insert into tmpa select 1,'aa' from dual;
insert into tmpa select 1,'bb ......