Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

pl/sql ʵÏֹ鲢Ëã·¨

ÔÚÍøÉÏ¿´µ½¹ØÓڹ鲢Ëã·¨£¬Ã»ÓÐÊý¾Ý¿â¼¶µÄ£¬µ±È»Êý¾Ý¼¶µÄËã·¨¶ÔÓÚÊý¾Ý¿âÀ´Ëµ¾ÍÊÇÒ»¸öÅÅÐò¡£½ñÌìдһ¸öpl/sqlµÄ¹é²¢Ëã·¨¡£
¹é²¢µÄËã·¨ºÜÈÝÒ×Àí½â£¬ÍøÉϺÜÏêϸ£¬ÏÖÖ»°ÑÔ´ÂëÌù³öÀ´¡£
£¨°üÉùÃ÷²¿·Ö£©
CREATE OR REPLACE PACKAGE PG_MERGESORT IS
  -- Author  : wealth_khb@126.com
  -- Created : 2009-10-20 10:09:16
  -- Purpose :
  TYPE EMP_SSN_ARRAY IS TABLE OF NUMBER INDEX BY BINARY_INTEGER; ---ÉùÃ÷Êý×éÀàÐÍ
  BEST_EMPLOYEES EMP_SSN_ARRAY; ----Êý×é
  BIG_UPPER    INTEGER;
  MIDDLE_VALUE NUMBER; ---------×î´ó
  -- Public function and procedure declarations
  ------³õʼ»¯¹ý³Ì
  PROCEDURE PRO_MERGESORT(UPPER_N IN NUMBER);
  FUNCTION FUN_MERGESORT(UPPER_ARRAY IN EMP_SSN_ARRAY) RETURN EMP_SSN_ARRAY;
  FUNCTION FUN_MERGE(LEFT_ARRAY  IN EMP_SSN_ARRAY,
                     RIGHT_ARRAY IN EMP_SSN_ARRAY) RETURN EMP_SSN_ARRAY;
END PG_MERGESORT;
£¨°üÌ岿·Ö£©
CREATE OR REPLACE PACKAGE BODY PG_MERGESORT IS
  PROCEDURE PRO_MERGESORT(UPPER_N IN NUMBER) IS
    V_EMP_SSN_ARRAY EMP_SSN_ARRAY;
    V_L             INTEGER;
  BEGIN
    V_L       := 1;
    BIG_UPPER := UPPER_N; ---×î´ó³¤¶È
    ------¶ÔÊý×鸳ֵ
    FOR X IN 1 .. BIG_UPPER LOOP
      BEST_EMPLOYEES(X) := X * (DBMS_RANDOM.VALUE(X, 1));
    END LOOP;
    ---·µ»Ø 
     DBMS_OUTPUT.PUT_LINE('ÅÅÐòÇ°'||V_EMP_SSN_ARRAY.COUNT||'¸ö');
    FOR P IN BEST_EMPLOYEES.FIRST .. BEST_EMPLOYEES.LAST LOOP
      DBMS_OUTPUT.PUT_LINE(BEST_EMPLOYEES(P));
    END LOOP;
    V_EMP_SSN_ARRAY := FUN_MERGESORT(BEST_EMPLOYEE


Ïà¹ØÎĵµ£º

SQLSERVER SQLÐÔÄÜÓÅ»¯

1.Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)¡¡¡¡
¡¡¡¡ SQLSERVERµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬Òò´Ëfrom×Ó¾äÖÐдÔÚ×îºóµÄ±í£¨»ù´¡±ídriving table£©½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏ£¬±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í£¬µ±SQLSERVER´¦Àí¶à¸ö±íʱ£¬»áÔËÓÃÅÅÐò¼°ºÏ²¢µÄ·½Ê½Á ......

PL/SQLÖÐGOTOÓï¾äºÍ±êÇ©

ÔÚPL/SQLÖÐÒ²ÌṩGOTOÓï¾ä,ÆäÓï·¨ÊÇ
GOTO label;
ÕâÀïlabelÊÇÔÚPL/SQL¿éÖж¨ÒåµÄ±êÇ©.±êÇ©ÊÇÓÃË«¼ýÍ·À¨ºÅÀ¨ÆðÀ´µÄ.µ±Ö´ÐÐGOTOÓï¾äµÄʱºò,¿ØÖÆ»áÁ¢¼´×ªµ½ÓɱêÇ©±êʶµÄÓï¾ä.
1.¶ÔÓÚGOTOµÄÏÞÖÆ
a.¶ÔÓÚ¿é,Ñ­»·»òÕßIFÓï¾ä¶øÑÔ,ÏëÒª´ÓÍâ²ãÌøµ½ÄÚ²ãÊÇ·Ç·¨µÄ.
b.ʹÓÃGOTO×Ó¾ä´ÓÒ»¸öIF×Ó¾äÌøµ½ÁíÒ»¸ö×Ó¾äÖÐÒ²ÊÇ·Ç·¨µÄ.
begin
......

sql½âÎö


SqlHelper ÀàʵÏÖÏêϸÐÅÏ¢
SqlHelper ÀàÓÃÓÚͨ¹ýÒ»×龲̬·½·¨À´·â×°Êý¾Ý·ÃÎʹ¦ÄÜ¡£¸ÃÀ಻Äܱ»¼Ì³Ð»òʵÀý»¯£¬Òò´Ë½«ÆäÉùÃ÷Ϊ°üº¬×¨Óù¹Ô캯ÊýµÄ²»¿É¼Ì³ÐÀà¡£
ÔÚ SqlHelper ÀàÖÐʵÏÖµÄÿÖÖ·½·¨¶¼ÌṩÁËÒ»×éÒ»ÖµÄÖØÔØ¡£ÕâÌṩÁËÒ»ÖֺܺõÄʹÓà SqlHelper ÀàÀ´Ö´ÐÐÃüÁîµÄģʽ£¬Í¬Ê±Îª¿ª·¢ÈËԱѡÔñ·ÃÎÊÊý¾ÝµÄ·½Ê½ÌṩÁ˱ØÒ ......

¹ØÓÚsql serverµÄ1433ºÍ1434¶Ë¿Ú

ת×Ô£º°Ù¶È°Ù¿Æ
Ëùν¶Ë¿Ú£¬¾ÍÊÇÏ൱ÓÚ»úÆ÷ÓëÍâ½ç½Ó´¥µÄ´°¿Ú¡£¶Ë¿ÚÆäʵÊÇÈí¼þµÄ´°¿Ú£¬¾ÍÊÇ˵һ¸öÈí¼þÈç¹ûÒªºÍÍâ½çÁªÏµ£¬¾Í±ØÐë´ò¿ªÒ»¸ö¶Ë¿Ú£»1434¶Ë¿ÚÊÇ΢ÈíSQL Serverδ¹«¿ªµÄ¼àÌý¶Ë¿Ú¡£ÄãҪʹÓÃSQL£¬¾Í±ØÈ»´ò¿ª1433ºÍ1434¶Ë¿Ú¡£
ĬÈÏÇé¿öÏ£¬SQL ServerʹÓÃ1433¶Ë¿Ú¼àÌý£¬ºÜ¶àÈ˶¼ËµSQL ServerÅäÖõÄʱºòÒª°ÑÕâ¸ö¶Ë¿Ú¸Ä± ......

SQL²ÎÊý»¯ÅÅÐòÏê½â

±àдһ¸ö´¢´æ¹ý³Ìusp_GetSortedShippers£¬Ëü½ÓÊÕNorthwindÊý¾Ý¿âÖÐShippers±íµÄÒ»¸öÁÐÃû³Æ×÷ΪÆäÖÐÒ»¸öÊäÈ루@colname£©£¬²¢´Ó¸Ã±í·µ»Ø°´ÊäÈëµÄÁÐÃûÅÅÐòµÄÐС£ÁíÒ»¸öÊäÈ루@sortdir£©±íʾÅÅÐòµÄ·½Ïò,‘A’±íʾ°´Éý˳ÅÅÐò,‘D’±íʾ°´½µÐòÅÅÐò¡£±àд¸Ã´æ´¢¹ý³ÌʱҪעÒâËüµÄÐÔÄÜ£¬¼´£¬¾¡¿ÉÄܵÄʹÓÃË÷Òý£¨ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ