zoukankan      html  css  js  c++  java
  • sqlldr自定义函数调用

     知识点
    1.自动产生id
    2.定长数据处理
    3.自定义函数使用.

    unrecoverable
    LOAD DATA
    INFILE 
    'tmp.txt'
    BADFILE 
    'tmp.bad'
    TRUNCATE
    INTO TABLE sss
    (
        ID    sequence (
    max,1),
        主叫号码 POSITION(
    01:22) "decode(:主叫号码,'00C','',:主叫号码)",
        主叫号码长度 "decode(:主叫号码,
    '00C',0,length(:主叫号码))",
        被叫号码 POSITION(
    23:42),
        被叫号码长度 "length(:被叫号码)",
        通话时间 POSITION(
    43:82) "FUNC_GETDATE(:通话时间)",
        通话长度 POSITION(
    43:82) "FUNC_GETTHSJ(:通话长度)"
        
    )



    函数代码
    CREATE OR REPLACE FUNCTION "FUNC_GETDATE" (
      
    str in varchar2
    )
    return varchar2
    as
    begin
      
    return '20' || substr(str,6,2||'-' || substr(str,8,2||'-' || substr(str,10,2|| ' ' || substr(str,12,2)|| ':' || substr(str,14,2|| ':' || substr(str,16,2);
    end;

    CREATE OR REPLACE FUNCTION "FUNC_GETTHSJ" (
     
    str in varchar
    )
    return number
    as
    begin
      
    return substr(str,18,6);
    end;

    sqlldr userid=aaa/bbb control=sssss.ctl log=a.log direct=yes
  • 相关阅读:
    5. Longest Palindromic Substring
    24. Swap Nodes in Pairs
    23. Merge k Sorted Lists
    22. Generate Parentheses
    21. Merge Two Sorted Lists
    20. Valid Parentheses
    19. Remove Nth Node From End of List
    18. 4Sum
    17. Letter Combinations of a Phone Number
    14. Longest Common Prefix
  • 原文地址:https://www.cnblogs.com/yg_zhang/p/1035876.html
Copyright © 2011-2022 走看看