• sqlserver to oracle


    SELECT     c.*, d .Organization_Name, d .ParentId, e.Roles_ID, e.Roles_Name
    FROM
    (    
        SELECT a.*, b.Organization_ID
        FROM
        (
            SELECT a.User_ID, MIN(User_Code) User_Code, MIN(User_Account) User_Account,
             MIN(User_Pwd) User_Pwd, MIN(User_Name) User_Name, MIN(User_Sex) User_Sex,
              min(User_IDcardNo) User_IDcardNo, MIN(Mobile) Mobile, MIN(DeleteMark) DeleteMark, 
              ztbm_id_s = STUFF (
                                (SELECT ',' + b.ZTBM_ID FROM TB_ZYM_UserZTBM b WHERE b.User_ID = a.User_ID FOR XML PATH('')),
                                 1, 1, ''
                                 )
            FROM Base_UserInfo a
            GROUP BY a.user_id
        ) a 
        LEFT OUTER JOIN dbo.Base_StaffOrganize b ON a.User_ID = b.User_ID) c 
        LEFT OUTER JOIN dbo.Base_Organization d ON c.Organization_ID = d .Organization_ID
        LEFT OUTER JOIN (
        SELECT b.*, a.User_ID FROM dbo.Base_UserRole a 
        INNER JOIN dbo.Base_Roles b ON a.Roles_ID = b.Roles_ID
    ) 
    e ON e.User_ID = c.User_ID
    SELECT     c.*, d .Organization_Name, d .ParentId, e.Roles_ID, e.Roles_Name
    FROM
    (    
        SELECT a.*, b.Organization_ID
        FROM
        (
            SELECT   a.User_ID, MIN(User_Code) User_Code, MIN(User_Account) User_Account, 
            MIN(User_Pwd) User_Pwd, MIN(User_Name) User_Name, MIN(User_Sex) User_Sex, min(User_IDcardNo) 
                  User_IDcardNo, MIN(Mobile) Mobile, MIN(DeleteMark) DeleteMark
                  ,(select wm_concat(b.ZTBM_ID) from TB_ZYM_UserZTBM b WHERE b.User_ID = a.User_ID ) ztbm_id_s
            FROM      Base_UserInfo a
            GROUP BY a.user_id
        ) a 
        LEFT OUTER JOIN Base_StaffOrganize b ON a.User_ID = b.User_ID
    ) c 
    LEFT OUTER JOIN Base_Organization d ON c.Organization_ID = d .Organization_ID
    LEFT OUTER JOIN (
        SELECT b.*, a.User_ID FROM Base_UserRole a 
        INNER JOIN Base_Roles b ON a.Roles_ID = b.Roles_ID
        ) 
    e ON e.User_ID = c.User_ID

     ,wm_concat(pic_url) pic_url

    ,pic_url=STUFF((select '|'+pic_url from TB_ZYM_LOG_Image u where u.log_id=TB_ZYM_LOG_Image.log_id FOR xml path('')),1,1,'') 

    1查询所有@  替换成:

    2 SqlDatabase-->OracleDatabase

    3 top

    4 STUFF--->wm_concat

    5 dbo.  去除

    6 as 去除

    7 case when

    8 with  xxx as

    9 cast 

    10 isnull---》nvl

    11 GETDATE()  ---》  sysdate

    12 NEWID()-----SYS_GUID()

    13 null和’’(空字符串)是一个意思     https://www.cnblogs.com/memory4young/p/use-null-empty-space-in-oracle.html

     14 oracle 没有 [字段]  这种表达方式 去掉 中括号

    
    
    
  • 相关阅读:
    linux最常用命令记录(一)
    2020centos解决“nginx 403 Forbidden"错误的故事
    nginx显示静态html爆502 bad gateway的错误提示
    codeigniter框架的使用感受和注意事项
    网闸
    抗DDOS防火墙
    负载均衡
    上网行为管理
    漏洞扫描系统
    网络分析系统
  • 原文地址:https://www.cnblogs.com/mingjing/p/7993423.html
Copyright © 2020-2023  润新知