How to use nvl() function in SQL Loader

I am trying to use nvl() funtion in my SQL Loader control file and I keep geting errors. Would someone please tell me where I can find the syntax reference to this?
Thanks a lot!

I just answered a similar question like this last Thursday.
SQL*LOADER how to load blanks when data is null

Similar Messages

  • How to use NVL Function

    hi,
    i want to use nvl Function in that Quary
    select f_words(SUM(a.AMOUNT)+sum(a.vat_amount) +
    nvl( (select sum(b.LABOUR_AMT)+sum(b.service_tax_amt)
    from LAB_WORK_DTL b
    where a.bill_no =b.bill_no), 0)
    )) as t
    from TRANSACTION_DETAILS a
    where a.bill_no =:P42_bill_no
    group by a.BILL_NO;
    i am using NVL in that Quary Like This
    select f_words*(nvl(S*UM(a.AMOUNT)+sum(a.vat_amount) +
    nvl( (select sum(b.LABOUR_AMT)+sum(b.service_tax_amt)
    from LAB_WORK_DTL b
    where a.bill_no =b.bill_no), 0)
    )) as t
    from TRANSACTION_DETAILS a
    where a.bill_no =:P42_bill_no
    group by a.BILL_NO;
    I want to use NVL Function In BOLD
    How Can I use NVL Functiion.
    Thanks
    Edited by: Manoj Kaushik on Mar 25, 2010 5:55 AM

    hi,
    select f_wordsl(SUM(a.AMOUNT)+sum(a.vat_amount) +
    nvl( (select sum(b.LABOUR_AMT)+sum(b.service_tax_amt)
    from LAB_WORK_DTL b
    where a.bill_no =b.bill_no), 0)
    )) as t
    from TRANSACTION_DETAILS a
    where a.bill_no =:P42_bill_no
    group by a.BILL_NO;
    i have two tables Bill no is comman field in both tables if i have not enter value in any one of the table .
    so how can i show Total amount in words if Bill NO are not in any one table.
    Thanks

  • How to use Conditional statements in SQL Loader control file

    Hi,
    I am using sql loader to load a flat file to the table. I am using control file for this purpose as show below:
    LOAD
    INTO TABLE store_shrink
    TRUNCATE
    FIELDS TERMINATED BY "     "
    TRAILING NULLCOLS
    SITE_ID char,
    ST_SHRINK char,
    ST_REVENUE char,
    SHRINK_PR char ":ST_SHRINK/:ST_REVENUE"
    My question is this. If in the flat file the value of 'ST_REVENUE' is '0', then I want 'SHRINK_PR' to be '0' as well, and skip the calculation (:st_shrink/:st_revenue).
    How to achieve this with the conditional statement or using any Oracle function?
    Any help or suggestion is greatly appreciated.
    Thanks in advance.

    Hi there,
    I tried the following in my above query and it doesn't work somehow. Anyone has an idea? I have been on internet throughout but to no avail. Please help:
    LOAD
    INTO TABLE store_shrink
    TRUNCATE
    FIELDS TERMINATED BY "     "
    TRAILING NULLCOLS
    SITE_ID char,
    ST_SHRINK char,
    ST_REVENUE char,
    SHRINK_PR char "case (when :st_revenue<>'0.00' then :SHRINK_PR=:ST_SHRINK/:ST_REVENUE else :SHRINK_PR='0.00') end"
    )

  • Using User function in SQL*Loader

    Hi, I have created the following control file. I am using DIRECT path insert. I am using a function to retrieve the column system_date. However, when I am running sql*loader, the fields system_date and load_date are loaded with null value.
    OPTIONS (ERRORS=999999999, DIRECT=TRUE, ROWS=100000, SKIP=1)
    LOAD DATA
    INFILE 'Z:\xx.csv'
    APPEND
    PRESERVE BLANKS
    INTO TABLE TB_RAW_DATA
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    REFERENCE_NUMBER,     
    SYSTEM_DATE "pkg_ken_utility.Fn_ken_get_param_value('SYSTEM_DATE','SYSTEM_DATE')",
    LOAD_DATE "SYSDATE"
    )

    No,
    You can not call PL/SQL functions in DIRECT PATH mode, also this is documented, so you should not need to ask.
    Sybrand Bakker
    Senior Oracle DBA

  • How to use evaluate function for sql server function

    Hi Team,
    We have imported a column(date dtat type) from SQL server cube . By default it imported as varchar,. We have three option in physical layer for this column(Varchar,Intiger,unknown)
    So we want to convert this column into date.can we use evaluate or there is any option to do that.?

    Hi,
    I am not sure your requirement. But how pass evaluate function obiee?
    syntax:- EVAULATE('your db function(%1,%2)', parameter list)
    here %1 and %2 are the no.of parameters (columns or may constant values) to be passed for the db-function
    if you have 3 parameters then you need to use %3 also.. means the columns to be passed.
    following exapmples are for ORACLE db,
    ex1: EVALUATE('upper(%1)', 'satya ranki reddy') gives the result as -> SATYA RANKI REDDY
    ex2: EVALUATE('upper(%1)', 'Markets.Region') here Markets.Region is column.
    you also can call the user-defined functions through evaulate
    EVALUATE('functioname(%1,%2), column1, column2)
    the above function has 2 parameters to be inputted
    Hope this help's
    Thanks
    Satya

  • How to use WITH functionality in sql server

    How to get year wise total between two dates from invoice table , if table not contain Years also will be display
    Example:  10-04-2013 ,20-2-2015. These are From and To Dates
    Hear i want to display
      Total Amount           year
      Null                          2013
      10000000                2014
      NUll                         2015
    My table contain only  dates between 01-01-2014 to till date Records
     

    The use of a CTE is not required - and an actual calendar table should be.  You can find many many suggestions for building a calendar table (dynamically or permanently) by searching.  Your example is fairly trivial, but real data (in real quantities)
    will benefit from the calendar approach in a number of ways.  For future reference, have a look at the sticky posts at the top of the forum - they provide suggestions for posting questions and including useful, relevant, and needed information. 
    Among these are a script that can be used to demonstrate your issue.  Here is one example using a derived table - it can be easily changed to use a CTE for the current dates derived table (which you should try to do if that is your goal since you will
    learn more in the process):
    set nocount on;
    declare @table table (tran_date date, amount decimal(14,2));
    insert @table (tran_date, amount) values ('20140215', 100), ('20140430', 20.55);
    select *
    from @table as t inner join ( values (cast('20130101' as date), cast('20131231' as date)), ('20140101', '20141231'), ('20150101', '20151231')) as dates(d_start, d_end)
    on t.tran_date between dates.d_start and dates.d_end
    select year(dates.d_end) as [Year], sum(t.amount) as Total
    from @table as t right join ( values (cast('20130101' as date), cast('20131231' as date)), ('20140101', '20141231'), ('20150101', '20151231')) as dates(d_start, d_end)
    on t.tran_date between dates.d_start and dates.d_end
    group by dates.d_end
    order by dates.d_end

  • How to use MAX function in SSAS MDX Query

    I want to run this Query with MAX Condition on LAST_DATA_UPDATE Column .

    Hi Ashishsingh,
    According to your description, you want to know how to use MAX function in SQL Server Analysis Services MDX Query, right? In this case, please refer to the link below which describe the syntax and sample of MDX function.
    http://technet.microsoft.com/en-us/library/ms145601.aspx
    http://www.mdxpert.com/Functions/MDXFunction.aspx?f=64
    Hope this helps.
    Regards,
    Charlie Liao
    TechNet Community Support

  • How to use complex function as condition in Oracle Rule Decision Table?

    How to use complex function as condition in Oracle Rule Decision Table?
    We want to compare an incoming date range with the date defined in the rules. This date comparison is based on the input date in the fact & the date as defined for each rule. Can this be done in a decision table?

    I see a couple of problems here.
    First, what you posted below is not a syntactically valid query. It seems to be part of a larger query, specifically, this looks to be only the GROUP BY clause of a query.
    Prabu ammaiappan wrote:
    Hi,
    I Have a group function in the Query. Below is the Query i have used it,
    GROUP BY S.FREIGHTCLASS,
    R.CONTAINERKEY,
    S.SKU,
    S.DESCR ||S.DESCRIPTION2,
    S.PVTYPE,
    RD.LOTTABLE06,
    R.WAREHOUSEREFERENCE,
    RD.TOLOC,
    R.ADDWHO,
    R.TYPE,
    S.CWFLAG,
    S.STDNETWGT,
    S.ORDERUOM,
    R.ADDDATE,
    C.DESCRIPTION,
    (CASE WHEN P.POKEY LIKE '%PUR%' THEN 'NULL' ELSE to_char(P.PODATE,'dd/mm/yyyy') END),
    NVL((CASE WHEN R.ADDWHO='BOOMI' THEN RDD.SUPPLIERNAME END),SS.COMPANY),
    RDD.BRAND,
    S.NAPA,
    RD.RECEIPTKEY,
    R.SUSR4,
    P.POKEY,
    RDD.SUSR1,
    r.STATUS, DECODE(RDD.SUSR2,' ',0,'',0,RDD.SUSR2),
    rd.SUSR3Second, the answer to your primary question, "How do I add a predicate with with a MAX() function to my where clause?" is that you don't. As you discovered, if you attempt to do so, you'll find it doesn't work. If you stop and think about how SQL is processed, it should make sense to you why the SQL is not valid.
    If you want to apply a filter condition such as:
    trunc(max(RD.DATERECEIVED)) BETWEEN TO_DATE('01/08/2011','DD/MM/YYYY') AND TO_DATE('01/08/2011','DD/MM/YYYY')you should do it in a HAVING clause, not a where clause:
    select ....
      from ....
    where ....
    group by ....
    having max(some_date) between this_date and that_date;Hope that helps,
    -Mark

  • How to use the function who returns an array?

    how to use getAllT in pls/sql or in java?
    --------------------------------------------------->
    create or replace package honghai as
         type TType is varray(25) of number;
    /*it can be like : type TType is table of number;
         function getCountT return number;
         function getAllT return TType;
    end honghai;
    create or replace package body honghai as
    a number;
    function getCountT return number is
         acount number;
         begin
              select count(*) into acount from testasb.t;
              return acount;
         end getCountT;
         function getAllT
         return TType is
         results TType;
         begin
              select testid into results(25) from testasb.T ;
              return results ;
         end getAllT;
    begin
         a := 2;     
    end honghai;
         

    For the java part, click on the link below:
    http://osi.oracle.com/~tkyte/ResultSets/index.html
    For the pl/sql part specific to your problem, see the code below. Since you did not provide any table structure or sample data, I used some simple data for demonstration purposes:
    SQL> CREATE TABLE t
      2    (testid NUMBER)
      3  /
    Table created.
    SQL> INSERT INTO t
      2  VALUES (1)
      3  /
    1 row created.
    SQL> INSERT INTO t
      2  VALUES (2)
      3  /
    1 row created.
    SQL> CREATE OR REPLACE PACKAGE honghai
      2  AS
      3    TYPE ttype IS REF CURSOR;
      4    FUNCTION getcountt RETURN NUMBER;
      5    FUNCTION getallt RETURN ttype;
      6  END honghai;
      7  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY honghai
      2  AS
      3    a NUMBER;
      4    FUNCTION getcountt RETURN NUMBER
      5    IS
      6      account nUMBER;
      7    BEGIN
      8      SELECT COUNT (*)
      9      INTO   account
    10      FROM   scott.t;
    11      RETURN account;
    12    END getcountt;
    13    FUNCTION getallt RETURN ttype
    14    IS
    15      results ttype;
    16    BEGIN
    17      OPEN results for 'SELECT testid FROM scott.t';
    18      RETURN results;
    19    END getallt;
    20  BEGIN
    21    a := 2;
    22  END honghai;
    23  /
    Package body created.
    SQL> VARIABLE g_num NUMBER
    SQL> VARIABLE g_ref REFCURSOR
    SQL> EXEC :g_num := honghai.getcountt
    PL/SQL procedure successfully completed.
    SQL> EXEC :g_ref := honghai.getallt
    PL/SQL procedure successfully completed.
    SQL> PRINT g_num
         G_NUM
             2
    SQL> PRINT g_ref
        TESTID
             1
             2

  • How to use email function in crystal report ?

    Post Author: kudo
    CA Forum: .NET
    Hi I'm a novice by touching .net not more than 2 months. Can somebody guide me how to use email function provided in crystal report components?(Better put a sample code so that I can understand well.)  ps: I'm using VS2005 VB.net.Thanks.

    Post Author: mewdied
    CA Forum: .NET
    'EXPORT to EMAIL        ''' Code for exporting the report to Mapi (.Net Windows application)        ''' *For a Web application you must export to disk as a PDF file first.
            crReportDocument.Load(Application.StartupPath + "\World Sales Report.rpt")        crMicrosoftMailDestinationOptions = New MicrosoftMailDestinationOptions        With crMicrosoftMailDestinationOptions            .MailCCList = "[email protected]"            .MailToList = "[email protected]"            .MailSubject = "Attached exported report"            .UserName = "admin"            .Password = "password"        End With
            crExportOptions = crReportDocument.ExportOptions        With crExportOptions            .DestinationOptions = crMicrosoftMailDestinationOptions            .ExportDestinationType = ExportDestinationType.MicrosoftMail            .ExportFormatType = ExportFormatType.PortableDocFormat        End With
            'Add some error handling        Try            crReportDocument.Export()            MsgBox("Report exported successfully.")        Catch err As Exception            MessageBox.Show(err.ToString())        End Try
    Hope this helps

  • How to use TRUNC function with dates in Expression Builder in OBIEE.

    Hi There,
    How to use TRUNC function with dates in Expression Builder in OBIEE.
    TRUNC (SYSDATE, 'MM') returns '07/01/2010' where sysdate is '07/15/2010' in SQL. I need to use the same thing in expression builder in BMM layer logical column.
    Thanks in advance

    use this instead:
    TIMESTAMPADD(SQL_TSI_DAY, ( DAYOFMONTH(CURRENT_DATE) * -1) + 1, CURRENT_DATE)

  • How to use HexToRef function?

    How to use HexToRef function?

    Exactly HexToRef!
    please, try this:
    create or replace
    TYPE "TOBJECT" as object
    Guid RAW(16)
    create table t$tobject of tobject;
    insert into t$tobject values (TOBJECT(SYS_OP_GUID()));
    select HEXTOREF(REFTOHEX(REF(t))) from t$tobject t;
    Error report:
    SQL Error: ORA-24360: 'Type Descriptor Object' не задан для 'Object Bind/Define'
    24360. 00000 - "Type Descriptor Object not specified for Object Bind/Define"
    *Cause:    Type Descriptor Object is a mandatory parameter for Object Types
    Binds and Defines.
    *Action:   Please invoke the OCIBindObject() or OCIDefineObject() call
    with a valid Type Descriptor Object.

  • How to use read_text function module

    Hi how to use read_text function module to read purchase order header text .what are all tht things to pass in ID,Name and Object
    thanks,
    Mahe

    Dear,
    Use below code.
    DATA:IT_LINE LIKE TLINE OCCURS 0 WITH HEADER LINE,
    V_TDNAME LIKE THEAD-TDNAME.
    V_TDNAME = PO_NUMBER.
    CALL FUNCTION 'READ_TEXT'
      EXPORTING
    *   CLIENT                        = SY-MANDT
        ID                            = 'F01'
        LANGUAGE                      = 'EN'
        NAME                          = V_TDNAME
        OBJECT                        = 'EKKO'
      TABLES
        LINES                         = IT_LINE.
    Thanks and Regards,

  • How to Eliminate Special Character in SQL LOADER Script

    How to eliminate special character from SQL LOADER script file which suppose not to insert in TABLE
    example.CSV lile like this
    <ABC/ , 7747>
    <DEF/ , 7763>
    <NEW/ , 7779>
    <OLD/, 7795>
    I have to remove < > and / character at the time of loading into table. How It could be done. It is not possible to remove < , > , / character manually from CSV file

    On Unix/Linux that's very easy, on Windows... I don't know...
    $ cat myfile.csv
    <ABC/ , 7747>
    <DEF/ , 7763>
    <NEW/ , 7779>
    <OLD/, 7795>
    $ tr -d "\057\074\076" <myfile.csv >outfile.csv
    $ cat outfile.csv
    ABC , 7747
    DEF , 7763
    NEW , 7779
    OLD, 7795
    $

  • How to use standard function keys as custom keys

    how to use standard function keys as custom keys.
    i have encountered that problem while developing a screen, there i'm supposed to use standard function key F2 ( which actually meant for choose) for clearing the screen fields where the cursor is present and f1 for saving data that entered in screen fields, etc...
    kindly help me out.

    Hi ,
    Solution to use SAP reserve function keys F1 .. F4 (mostly this requirement comes up for RF screens) can be acheived by assigning your new Function code using the Menu path Utilities --> F key Consistency in the Menu Painter (SE41) . Once you assign your cutom function code to the standard Fn keys the only remaining step is to make sure that you set a curson on any of the field on sceen by using the Key Word "SET CURSOR" .
    If you dont use the key word SET CURSOR in the PBO of the screen then you might not see any response for F4.
    Thanks

Maybe you are looking for

  • Future date in background job

    hi experts,                can anybody pls give me sample code for running proram in backgrnd mode <b>(not immediate run but a future time), moreever it should be done thru programs not sm36 and 37.</b> thanks pankaj

  • Adding soap action in http header

    Hi , Can any tell me how configure proxy to add SoapAction in http header of outgoing message from ESB. Thanks

  • Requests to reserve materials against a Mass Purchase Order

    Dear All, I need your help concerning the following senario. General Introduction. In our company environment (FERRY BOAT operator) each Vessel is represented as a PLANT. The materials I am talking about are CONSUMABLES. The Problem.  At the beginnin

  • Icons disapear after fullscreen MSDOS window

    Hi there, I'm currently experiencing problems with Swing Icons under Windows with jdk1.4.1 ! They suddenly disappear or are corrupted if I maximize and then minimize the DOS Window. I've read in the bug database that there is this problem with a spec

  • Flash Player 10.1 not working for Mac

    I recently downloaded the new flash player 10.1 for my mac and also have updated to the latest safari browser but every time i try and watch any videos or play flash games it doesn't work and i'm told to download the latest flash player. I've tried u