Getting the position in SQLLoader using oracle function

Hi. I have a problem to create .ctl file.
i have a oracle function to retrieve position
CREATE OR REPLACE FUNCTION "TEST_KEYFIELDS" (rec_type IN VARCHAR2,fieldName in varchar2)
RETURN VARCHAR2
AS
pos_result VARCHAR2(10) := null;
BEGIN
select '(' || field_start || ':' || (field_start + field_length -1) || ')' into pos_result from test_layout
where record_type=rec_type and field_name=fieldName;
RETURN pos_result;
END TEST_KEYFIELDS;
and this will return
(16:25)
my question is can i use this function and call it in my .ctl. so i don't have to hardcoded the position.
please help me.
TQ

As yourself if you think it will be performant to call a query within a function for every row of data being processed in your loading rather than just hard-coding known values.
You can use functions if you really want, but I would suggest they are used sparingly.

Similar Messages

  • How to get the position of a tag in XML,when i am using the org.xml.sax

    Hi,
    I am able to parse a xml document.I want to get the position of a tag in the document.So that by keeping that as reference, i can access other tags.Plz help me.I am using org.xml.sax API.

    Hello Friends
    After research , I could also find another way to check the existence of a node .We can even use CHOOSE to check the existence.
    <xsl:choose>
          <xsl:when test="(/mynode)">
              your action if the mynode is found
          </xsl:when>
          <xsl:otherwise>
                    action if mynode is not found
          </xsl:otherwise>
    </xsl:choose>
    Thanks.
    Wishes
    Richa

  • Use SQL function to get the original order number using the invoice number

    Hi All,
    wondering is someone can help me with this challenge I am having?  Often I need to return the original order numbers that created the resulting invoce.  This is a relatively simple seriese of joins in a query but I am wanting to simplify it using a SQL function that can be referenced each time easily from with in the SELECT statement.  the code i currently have is:
    Use SQL function to get the original order number using the invoice number
    CREATE FUNCTION dbo.fnOrdersThatMakeInvoice(@InvNum int)
    RETURNS nvarchar(200)
    AS
    BEGIN
    DECLARE @OrderList nvarchar(200)
    SET @OrderList = ''
    SELECT @OrderList = @OrderList + (cast(T6.DocNum AS nvarchar(10)) + ' ')
    FROM  OINV AS T1 INNER JOIN
          INV1 AS T2 ON T1.DocEntry = T2.DocEntry INNER JOIN
          DLN1 AS T4 ON T2.BaseEntry = T4.DocEntry AND T2.BaseLine = T4.LineNum INNER JOIN
          RDR1 AS T5 ON T4.BaseEntry = T5.DocEntry AND T4.BaseLine = T5.LineNum INNER JOIN
          ORDR AS T6 ON T5.DocEntry = T6.DocEntry
    WHERE T1.DocNum = @InvNum
    RETURN @OrderList 
    END
    it is run by the following query:
    Select T1.DocNum, dbo.fnOrdersThatMakeInvoice(T1.DocNum)
    From OINV T1
    Where T1.DocNum = 'your invoice number here'
    The issue is that this returns the order number for all of the lines in the invoice.  Only want to see the summary of the order numbers.  ie if 3 orders were used to make a 20 line inovice I only want to see the 3 order numbers retuned in the field.
    If this was a simple reporting SELECT query I would use SELECT DISTINCT.  But I can't do that.
    Any ideas?
    Thanks,
    Mike

    Thanks Gordon,
    I am trying to get away from the massive table access list everytime I write a query where I need to access the original order number of the invoice.  However, I have managed to solve my own problem with a GROUP BY statement!
    Others may be interested so, the code is this:
    CREATE FUNCTION dbo.fnOrdersThatMakeInvoice(@InvNum int)
    RETURNS nvarchar(200)
    AS
    BEGIN
    DECLARE @OrderList nvarchar(200)
    SET @OrderList = ''
    SELECT @OrderList = @OrderList + (cast(T6.DocNum AS nvarchar(10)) + ' ')
    FROM  OINV AS T1 INNER JOIN
          INV1 AS T2 ON T1.DocEntry = T2.DocEntry INNER JOIN
          DLN1 AS T4 ON T2.BaseEntry = T4.DocEntry AND T2.BaseLine = T4.LineNum INNER JOIN
          RDR1 AS T5 ON T4.BaseEntry = T5.DocEntry AND T4.BaseLine = T5.LineNum INNER JOIN
          ORDR AS T6 ON T5.DocEntry = T6.DocEntry
    WHERE T1.DocNum = @InvNum
    GROUP BY T6.DocNum
    RETURN @OrderList 
    END
    and to call it use this:
    Select T1.DocNum, dbo.fnOrdersThatMakeInvoice(T1.DocNum)
    From OINV T1
    Where T1.DocNum = 'your invoice number'

  • How to get the position of the stem in control valve using slider control in the front panel

    I have created a calibration program for a control valve. Signal (4-20mA) is generated from labview using slider contorl which is given to the valve via DAQ(module 9265) and again the feedback signal from the valve is acquired using DAQ(module 9203).. . There is an input ISO/ISC(Increasing signal to open/ Increasing signal to close) in the front panel.
    ISO would set the output to increase from (4-20)mA further opening the valve
    ISC would set the output to increase from (4-20)mA further closing the valve
    I have doubt, how can i get the position of a stem

    Ravens Fan wrote:
    If the position of the stem is being sent to the PC through a 4-20 mA signal into your DAQ 9203 module, then you just need to do an analog input read in order to get the signal.
    When reading this post, that is what came to mind...  So let's see if both RavensFan & I are trying to understand the same thing...  Are you saying that the position of the stem is linear (or scaled) to the amount of current sent to it?  Meaning a 4mA signal would move it a certain distance, and 10mA would move another given / known distance?  Or are you saying that it is calibrated so that a 20mA signal for a certain duration (ms) would move it a given distance? So the scale would be time and not current unless a lookup table is used to adjust the time duration based on the current being drawn...
    It's just that I am not familiar with solenoid / drive devices that related to current..  To voltage, yes.  To time, yes..  To current, I'm simply saying that I am not familiar with that.  Can you tell us more about this stem (mfg / model designation)?

  • Is it possible to get the position of a charcter from a string ?

    Hi !
    Is it possible to get the position of a charcter from a string ?
    Example:
    @VAR contains the following text "ABCDEFGHIJKLM"
    I'am seaching for FGH, it start on pos. 6 en ends on pos 8.
    How can I get these numbers 6 and 8 ?
    So, I can use them in the MID(text,start,len) function.
    Thanks!

    Hi Sooraj,
    I'll explain more in detail:
    From a web-service I get a variable called @Spec.
    This variable contains the following:
    "MOTORTYPE[CR]D-QW1234[LF]PART[CR]1234-FRD-X[LF]"
    or
    "MOTORTYPE[CR]ABC[LF]PART[CR]E-435[LF]"
    I need the values behind MOTORTYPE[CR] and behind PART[CR]
    But you’ll see that the positions of these values are different each time.
    If there is a way to get the (start) position of "MOTORTYPE[CR]" or "PART[CR]" and the (end) position of the first "[LF]" behind that,
    then I could use the MID() function to get the correct values.
    The values will be displayed in a table view (between other fields).
    An ABAP-call/function won’t work . . . how should I invoke this within a table column/field object ? (system action ?)

  • How to use oracle functions in Crystal Reports XI using Oracle Server

    Hi all,
    Is it possible  to use oracle functions in Crystal Reports XI using Oracle Server as Data Source.
    If i try to use a procedure,i am getting error with message "Invalid Arguement Provided".
    Functions are not visible objects like tables,views and stored procedures.
    The  jdbs driver i m using is oracle.jdbc.driver.OracleDriver.

    I think it is not possible to add functions in crystal directly for any database. You need to use those functions in a stored procedure and add that storedprocedure as a datasource.
    [https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333233353335333833323333%7D.do]
    regards,
    Raghavendra

  • Problem with getting current date and time using oracle.jbo.domain.Date

    I`d like to get current date and time using oracle.jbo.domain.Date method getCurrentDate(), but it always return current date and 12:00:00. I also need to get the current time.

    I think you should use java.sql.Timestamp domain.
    (And set database type to TIME or DATETIME.)
    Jan

  • How can i get the position of my object

    HI,ALL! i get a queation now. when i picking some transfromgroup,and move it.(use picktranslatebehavior),i want to get the position of the transformgroup after it has been moved.so how can i get it?!Apology for my bad english .thanks!:)

    Check out:
    http://forum.java.sun.com/thread.jspa?threadID=633485&tstart=15

  • How can I get the position assigned to the user in CRM .

    Hi all ,
    How can we get the positions to which a  user is assigned as a holder in CRM .
    Thanks ,
    Naval bhatt .

    Hi,
         Use the PPM toolkit class CL_CRM_PPM_UM_TOOLKIT. You can use the method You can use the method GET_ASSIGNMENTS_OF_USER which returns positions held by an user(user name).  You may also find the method GET_POSITION_OF_USER useful. It accepts username and the organization ID and will return the positions held by the user under that organization.
      This class always uses the current plan (01). If you want otherwise, you can use the FM RH_STRUC_GET. As to how this FM should be used, look inside the above said methods.
    Regards,
    Arun Prakash
    Edited by: Arun Prakash Karuppanan on May 11, 2010 11:40 AM

  • Cannot get the correct data type in Oracle JDBC

    Dear ALL:
    I used JDBC ResultSetMetaData to get the column data type for Oracle Database. I created a table including 2 columns AAA, which is NUMBER type, BBB which is FLOAT type.
    However, I found a problem that either NUMBER or FLOAT data types are reported as NUMBER type in JDBC.
    IN SQL 2000, it is okay. SMALLINT, INT, TINYINT, etc..can be reported correctly.
    Can anybody tell me that what's wrong here? I will be very appreciated.

    hi,
    i guess its a bug which is fixed with 10i.
    Elango.

  • To get the position of the characters in the string in sql

    hi all,
    I need to get the position of the characters in the sql , the string like this '10101110111010111' , is it possible to get the answer like this
    pos char
    1 1
    2 0
    3 1
    4 0
    and so on .
    Thanks in advance .

    select level pos,substr(:your_string,level,1) "char"
      from dual
    connect by level <= length(:your_string)Regards
    Etbin
    Edited by: Etbin on 24.9.2011 8:46
    put char between double quotes http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/ap_keywd001.htm#BABCJAEB

  • Memory Leak when I get the SP return refcursor by oracle ODBC driver:

    Oracle server:&#65320;&#65328;&#65293;&#65333;&#65358;&#65353;&#65368;
    Oracle Version: 9.2.0.6.0
    Application Server: windows2003
    Develop tool &#65306; VC++;
    Question:
    when I get the return refcursor by OLEDB.Oracle, there is not any memory leak and work well. But when I change the driver to ODBC “Oralce in OraHome92"
    there will be an 56k memory leak.
    And in the other hand if I call an store precedure without return ref. Both driver /way can work well.
    Can you give me the advice? thanks a lot.
    Code such as:
    _ConnectionPtr m_AdoConnection;
    _CommandPtr pcmd = NULL;
    _RecordsetPtr sp_rs = NULL;
    _bstr_t bstrConstruct = _bstr_t("DSN=test;Uid=test;Pwd=test;PLSQLRSet=1");
    HRESULT hr = CoCreateInstance(__uuidof(Connection),NULL,CLSCTX_INPROC_SERVER,__uuidof(_ConnectionPtr),(LPVOID *)&m_AdoConnection);
    if (FAILED (hr) ) throw hr ;
    m_AdoConnection->PutCursorLocation(adUseClient) ;
    m_AdoConnection->IsolationLevel = adXactSerializable;
    m_AdoConnection->Mode = adModeShareExclusive;
    bstr_t bstrEmpty(L"") ;
    m_AdoConnection->Open (bstrConstruct, bstrEmpty, bstrEmpty, -1) ;
    SAFE_CALL(m_spObjectContext->CreateInstance(__uuidof(Command),__uuidof(_CommandPtr),(LPVOID *)&pcmd));
    if(pcmd == NULL)
    throw CAtlExceptionEx(E_POINTER,"pcmd is NULL");
    pcmd->CommandText = _bstr_t(L"wec_pkg_spl.wec_proc_spl_check");
    pcmd->CommandType = adCmdStoredProc;
    _bstr_t id = _bstr_t("65650000");     
    pcmd->Parameters->Append(pcmd->CreateParameter(_bstr_t(L"id"),DataTypeEnum(adVarChar),adParamInput,2000,_variant_t(id)));          
    pcmd->Parameters->Append(pcmd->CreateParameter(_bstr_t(L"errcode"),DataTypeEnum(adNumeric),adParamOutput,4));
    pcmd->Parameters->Append(pcmd->CreateParameter(_bstr_t(L"errdescription"),DataTypeEnum(adVarChar),adParamOutput,2000));
    pcmd->ActiveConnection = sp_con.m_AdoConnection;
    sp_rs = pcmd->Execute(NULL,NULL,adCmdStoredProc);
    pcmd->Release;          
    sp_rs->Close();     
    if (m_AdoConnection->State == adStateOpen)
    m_AdoConnection->Close();
    wec_pkg_spl.wec_proc_spl_check arguments:
    id          varchar2     in
    flowpaths     ref cursor     out
    errcode          number          out
    errdescription     varchar2     out
    Message was edited by:
    [email protected]

    I'm using the oracle ODBC driver 8.05.10 with MFC and client version 8.0.5. In my experience you can't prevent memory leaks with that or earlier versions of the ODBC driver. Client patchkits or service packs for NT or the Visual Studio doesn't solve the problem.
    The following code will result in a memory leak with the oracle driver. With every expiration of the timer the leak will grow.
    void CTestOdbcOracleDriverDlg::OnTimer(UINT nIDEvent)
    TCHAR errString[255];
    //open the database with class CDatabase
    //use of CRecordset
    TRY {
    //my table name is AL_ALARME_LOG
    pMyRecordset->Open(CRecordset::dynaset,"SELECT * FROM AL_ALARME_LOG",CRecordset::none);
    //do something with the data
    Sleep(0);
    pMyRecordset->Close();
    CATCH_ALL(error) {
    error->GetErrorMessage(errString,255);
    DELETE_EXCEPTION(error);
    END_CATCH_ALL
    CDialog::OnTimer(nIDEvent);
    The same code with the Microsoft ODBC driver
    doesn't cause memory leaks.
    Andreas ([email protected])

  • Get the position of the component on GUI ???

    Hi All,
    How can I get the position (x, y) of a component such as JCompoBox on Frame at runtime ?
    Thanks a lot,
    Huy

    To the the location of a JComponent in it's parent... just use the getLocation method on the JComponent.
    If you need that point relative to some other ancestor, I would use SwingUtilities.convertPoint
    Hope this helps,
    Josh Castagno
    http://www.jdc-software.com

  • I can not get the debugger to work on oracle studio 12.3 - It will not attach

    I can not get the debugger to work on oracle studio 12.3 - It will not attach

    APN for Tmobile is epc.tmobile.com
    MMSC is http://216.155.174.84/servlets/mms
    Here are the instructions:
    Create devel catalog (appl from this catalog can damage your phone but don't have to so if you are not sure about your needs or skills dont use it and wait for official applications from Nokia or firmware update) The software hosted in Extras-devel is NOT ready for normal users! PLEASE PLEASE PLEASE don't play with it unless you really know what you are doing. Be ready to file proper bug reports instead of posting complaints. Expected problems: crashes, battery drain, poor system performance, full disk space & more - SERIOUSLY! Don't play with Extras-devel if you haven't backed up your data or are prepared to re-flash your device.
    Application manager --> Application catalogs --> New
    Catalog name: Extras-devel
    Web address: http://repository.maemo.org/extras-devel
    Distribution: fremantle
    Components: free non-free
    Refresh catalogue
    Install fAPN and fMMS
    Run fAPN and create new APN with MMS setting which you can get from your operator or find on this page (this may not be needed for all users, see note below)
    Run fMMS and it will start with configuration
    Put APN name the same you named your MMS APN point during fAPN configuration
    Type MMSC which you can take from your operator
    Type your number starting with +
    Put max size of pics you want to have in outgoing MMS
    Save all and start sending MMS from fMMS menu.
    It is very important to put correct setting in new APN and be sure if there is proxy needed in your operator.
    WHEN YOU GO TO MMS to set your configuraions, the information should look like this
    MMSC: http://216.155.174.84/servlets/mms
    Resize Image: 300
    Your Phone Number: +##########
    NOW U ARE DONE!! =)

  • HT204053 I want to play newly purchased music but cant, i get the message "You can use iTunes Match on this computer with just one Apple ID every 90 days. (mobileme family pack is the problem i think)

    I purchase a new album on my phone but then cannot download it to my laptop -  I get the message:
    "You can use iTunes Match on this computer with just one Apple ID every 90 days. All I can think is that the problem stems from purchasing a mobileme family & some of the music being my daughters. (she is 9 & I need to be ble to listen to more than Katy Perry & Justin Bieber) Please help! :-(

    Welcome to the Apple Community.
    Youll get that message when you change the iTunes account you are logged into, you can't keep changing it.

Maybe you are looking for

  • Adding a serial number to a template in Numbers

    Hi everyone, I'm hoping someone may be able to help. I run a small business and would like to create an invoice template in Numbers. Could anyone tell whether there is a way to create a serial or invoice number each time I create a new document from

  • Wrong sort order for Photos taken in rapid sequence

    Hi! I have a number of Photos that are taken on the same second. These show up in what appear to be random order in the organizer. Is there any workaround for this, let´s say by first sorting on timestamp and then by file name (if timestamp is equal)

  • Textfile Problem (Very Urgent, Pls Help...)

    hi to all, I have a servlet that executes a program and then write the results to a textfile. Question 1: How do I know that the textfile is not empty? Question 2: If the textfile contains somethings, how can I append a sentence(That's all) all the l

  • How to keep order of required validation messages while displaying.

    Hi, I need to keep required validation messages as in the order of components in the page. Now it not showing properly. please let me know , if anybody have the solution. Vipin

  • It is the correct header of the sent letter from GroupWise ?

    It is the correct title of the sent letter from GroupWise in the Internet ? From the GrupoWise8.0.2 Reply to the Received mail. Reply to the foreign user (not Groupwise system). User received my answer in the mail header see: X-Mailer: Novell GroupWi