How to use substr in external table defnition.

Hi All,
Im using oracle 11g. I have an external table which is reading data from a file. For one of the column, i need to get only the first 250 characters. My external table defnition looks like this
create table tbl_substr
( col1 varchar2(20),
col2 varchar2(250)
organization external
( type oracle_loader
default directory XXXX
access parameters (
records delimited by newline
FIELDS TERMINATED BY '|'
missing field values are null
( col1 ,
col2 "substr(:col2,1,250)"
) ) location ('file.txt') )
reject limit unlimited
But this defnition gives an error when i do select * from tbl_substr
I want to use substr in external table defnition its self and not in SELECT. Also i dont want to crete a view to solve this. If anyone has done this please help.

You need to play with COLUMN_TRANSFORMS
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/et_params.htm#sthref1792
BTW, i too got it from Google. I was not aware about this :)
Amardeep Sidhu

Similar Messages

  • How to use Column_transform in external Table

    Hi
    Can you please help me out with the syntax of extenal table with Column_transform clause? I am trying to use a custom function to manipulate the data while loading into the column.Could you please give me an example?
    Regards

    Hi
    Can you please help me out with the syntax of extenal table with Column_transform clause? I am trying to use a custom function to manipulate the data while loading into the column.Could you please give me an example?
    Regards

  • How to use the item of table(ms access) in pl/sql

    I want to use oracle forms builer developer application with ms access database
    I don't know how to use the item of table in the pl/sql;please help me !

    MERGE INTO EmpDept Target
    Using (SELECT E.Address,
    e.Design,
    e.EmailId,
    e.EmpId,
    e.Ename,
    e.ManagerId,
    e.Salary,
    D.DeptId,
    D.DeptName,
    D.Location
    FROM Employee E
    INNER JOIN Dept D
    ON E.DeptId = D.DeptId) AS Source (Address, Design, EmailId, EmpId, EName, ManagerId, Salary, DeptId, DeptName, Location)
    ON Source.EmpId = Target.EmpId
    WHEN NOT matched THEN
    INSERT (Address,
    Design,
    EmailId,
    EmpId,
    Ename,
    ManagerId,
    Salary,
    DeptId,
    DeptName,
    Location)
    VALUES (Address,
    Design,
    EmailId,
    EmpId,
    EName,
    ManagerId,
    Salary,
    DeptId,
    DeptName,
    Location)
    WHEN matched THEN
    UPDATE SET Address = Source.Address,
    Design = Source.Design,
    EmailId = Source.EmailId,
    Ename = Source.Ename,
    ManagerId = Source.ManagerId,
    Salary = Source.Salary,
    DeptId = Source.DeptId,
    DeptName = Source.DeptName,
    Location = Source.Location;

  • How to use database look up table function in xsl mapping

    Can anybody tell me how to use database look up table function while mapping xsl between 2 nodes.
    I have an XML file coming in and depending on one of XML elements we need to decide which further path to take. But, using this XML element, we need to query database table, get metadata and accordingly take appropriate path. I have written lookup function which returns metadata value.
    Now, the issue is how do I pass the XML element valu as input to look up function? When I tried to drag it to the input node of lookup function, it throws an error like "Maximum number of parameters exceeded"
    Thanks,

    If the lookup table is always going to remain the same (e.g. a character generator or something similar) you can place the values in a 2D array constant on your diagram, with the input value as one column, the equivalent as the other. When you need to perform the lookup you use an index array to return all the values in the "input column", search it using "search 1D array" and use the resulting index number to index the other column's data. If the values may change, then it would probably be best to load an array control with your equivalent values from a file.
    P.M.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion

  • How to use substring in  ITS(HTML file)

    Hai,
    I am modifying d_searchhelp.html file in agate. I want a use a substring function this file. So I used the below code.
      newclassname=~searchhelpcontrolname;
      oldclassname=newclassname.substring(0,8);
                                                                ^ ^ ^
    This is the error i got when i use this HTML file in searchhelp.
    @ ...\templates\system\dm\msiexplorer\d_searchhelp.html (263,42): error : syntax error   : '('
    @ ...\templates\system\dm\msiexplorer\d_searchhelp.html (263,44): error : syntax error   : ','
    @ ...\templates\system\dm\msiexplorer\d_searchhelp.html (263,46): error : syntax error   : ')'
    Please let me know how to use substring.
    Thanks & Regards,
    H.K.Hayath Basha

    Hello H.K.Hayath Basha,
    please see the HTML Business documentation on <http://help.sap.com/saphelp_nw04/helpdata/en/5f/1fb5174aee11d189740000e8322d00/frameset.htm>:
      string strSub (in string string, in int position, in int length)
    With regards,
      TJ

  • [HTML DB] How to use the existing database table?

    [HTML DB] How to use the existing database table?
    I installed Oracle 10g database in Computer A(Windows 2000), and I already create all the tables with data and the data size is about 300MB.
    In Computer B(Windows 2000), I installed HTML DB 1.6.
    How can I use /get the existing database table (in computer A) for HTML DB?
    Could anyone help me on this? I am newbie and I need some detail instructions. or Where can I find the examples.....
    Thanks

    Well I guess if you wish to retain that architecture, i.e. HTMLDB on one machine and your data on another, you will have to establish database links to access the data. Oracle documentation will describe how to achieve that.

  • How to spilt files when using DATA UNLOAD (External Table, 10g)?

    Hi,
    I am runnin 10gR2 and need to export partitions by using data_pump driver
    via dmp files (External Tables).
    Now as requierment the created files can not exceed 2GB mark.
    Some of partitions are larger than that.
    How could I split the partition so I could be able to create files smaller than 2GB? Is there any parameter I am not aware of or do I need to do SELECT COUNT(*) FROM source_table PARTITION(partiton_01);
    and than to work with ROWNUM?
    This example working fine for all partitions samller than 2GB:
    CREATE TABLE partiton_01_tbl
    2 ORGANIZATION EXTERNAL
    3 (
    4 TYPE ORACLE_DATAPUMP
    5 DEFAULT DIRECTORY def_dir1
    6 LOCATION ('inv_xt1.dmp')
    7 )
    8 PARALLEL 3
    9 AS SELECT * FROM source_table PARTITION(partiton_01);

    You could specify multiple destination files in the LOCATION parameter (the number of files should match the degree of parallelism specified). I am not aware of an option that would allow the external table to automatically add new data files as the partition size increased, so you'd likely have to do some sort computation about the expected size of the dump file in order to figure out how many files to create.
    Justin

  • Substr in external table definition

    Hi Guys,
    I have an external table where I am loading a txt file. The issue being, in the txt file I have a column with a variable length. This column houses the application/website link that is not of a fixed length. My external table field width is 100, but the txt file value is more than that. Now, I want to only insert this field for the 100 characters.
    I tried using substr as shown in the example below, but it fails. Any idea what could be the alternative or if I am doing it right?
    Here's my external table properties (access parameters) and I am trying to use 'substr' on field4
    records delimited BY NEWLINE
    badfile BAD_DIR:'email_events%a_%p.bad'
    LOGFILE LOG_DIR:'email_events%a_%p.log'
    fields terminated by '\t'
    missing field values are null
    event_type,
    cm_timestamp,
    issue_id,
    cm_uid,
    field1,
    field2,
    field3,
    field4 "substr(:field4,1,100)",
    field5,
    field6,
    field7,
    field8,
    field9,
    field10,
    field11,
    field12,
    field13,
    field14
    )

    Just set your external table definition to query the full thing and then when you come to insert that data to a real table from the external table you can apply the substr in that query.

  • How to compare substring in two tables fields

    Hi ABAP expert,
    When I want to select database two tables, we just want to compare two table substring. For Example, both fields have yyyymmdd. But I have interested yyyymm. In the Oracle database and SQL server database, I can easily to use substr to achieve those goals. How in the ABAP program to archive those goals.
    Thanks in advance,
    Cliff Fan

    Hi you can access substrings in ABAP the following way:
    data: s type string value 'yyyymmdd'.
    write: / s(6). "yyyymm
    write: / s+4(4). "mmdd
    so the number after '+' determines the position in the string and the number in parenthesis () determines the length of the substring.
    Now you can just loop over both of your tables and perform the necessary comparison in the nested loop.

  • How to use the same external hard drive for OSX and XP

    Hello to all. First off, thanks for all of the helpful comments that have been posted in the discussion board, they have helped me a lot with my problems and curiosities. My question has been touched on in the past, but nothing concrete so I figured I'd ask a bit more specifically.
    I recently loaded Windows XP (FAT32)onto my MacBook. Everything is running smoothly, but I was just curious how I could format my external HD so that both operating systems can read it, i.e. I only have 20 GB's partitioned for Windows XP, and i'll be using it to download music and movies. I would like to be able to play these straight from my external rather than use up the disc space. Let me know if anybody can help! Thanks.

    Unfortunately, Disk Utility doesn't just move everything around. It has to erase everything, and then resize. I find it a little odd, seeing as other disk utilities can resize everything just fine. Anyway, yes, you will have to erase your drive to reformat it as FAT32. What I usually do is try to copy everything from the drive to free space in the internal drives. I haven't had too much data on my drive yet, so I've been lucky so far. I don't know if you have enough free space on whatever drives you have, but that's probably the best way to do it.
    1) Transfer everything over to a folder on the internal drive
    2) Use Disk Utility to reformat the drive as FAT32
    3) Transfer everything back to the external drive
    2.0GHz MacBook 1st Gen   Mac OS X (10.4.8)   2GB RAM

  • How to use create-default-dbms-tables in SQL Server 2000

    Hi everyone,
    I'm new in EJB development. I'm trying to deploy a CMP to Weblogic 8.1 SP1 using
    JBuilderX. I configured a ConnectionPool and DataSource to allow the CMP to access
    the SQL Server 2000. However, I cannot deploy the CMP if I didn't create the table
    in SQL Server manually. Does anyone know how to use the create-default-dbms-tables?

    Refer to
    http://e-docs.bea.com/wls/docs81/ejb/DDreference-cmp-jar.html#1162249
    "Keith" <[email protected]> wrote:
    >
    Hi everyone,
    I'm new in EJB development. I'm trying to deploy a CMP to Weblogic 8.1
    SP1 using
    JBuilderX. I configured a ConnectionPool and DataSource to allow the
    CMP to access
    the SQL Server 2000. However, I cannot deploy the CMP if I didn't create
    the table
    in SQL Server manually. Does anyone know how to use the create-default-dbms-tables?

  • How to use DataSource and External transaction in 9ias?

    I'm working on a project that the application server needs to connect to over 100 databases.
    I'd like to use connection pooling and external transaction service defined in OC4J's Datasources.
    I wonder if anyone has an example of using datasource and external transaction service for OC4J.
    Right now, I export toplink project to a java source and do the initialization there manually but I don't know how to use Datasource to get connections and how to use the external transaction service in the java code for OC4J.
    I really appreciate you help.
    Wei

    Here is a fill in the blank example on how you could set this up through code:
    Project project = new MyProject();
    // alternatively, use the XMLProjectReader
    server = project.createServerSession();
    server.getLogin().useExternalConnectionPooling();
    server.getLogin().setConnector(new JNDIConnector(new javax.naming.InitialContext(), "jdbc/DataSourceName"));
    // the next line depends on the type of driver you want to use.
    server.getLogin().useOracleThinJDBCDriver();
    server.getLogin().useOracle();
    server.getLogin().setUserName("username");
    server.getLogin().setPassword("password");
    server.getLogin().useExternalTransactionController();
    server.setExternalTransactionController(new Oracle9iJTSExternalTransactionController());
    server.logMessages();
    server.login();

  • How to use ans E\external camera as choice in ichat ?

    I have a macbook pro with a built in isight. I've tried using two other cameras as video source with no luck. both are cannon mini viedo cameras, The first camera I needed to get a firewire adaptor for. from a dv port of a camera to the firewire port of the pro. The second from the dv port to the usb port of the pro. I go to avchat preferences/video but only get the isight as a choice. What am I missing ? Do I need to install drivers ?

    You're welcome, Joe.
    I cannot find DV950 as a Canon model.
    (1) Perhaps you mean a Canon ZR950?
    If so, according to the info on page 67 of the ZR950 Instructions Manual, you should be able to connect to the Firewire (iLink® / iEEE 1394) port on the camera.
    More info about some "ZR" Canons: http://support.apple.com/kb/TA26556
    Try the suggestions there or contact Canon, Inc to see if they have ideas that might help you.
    (2) If not, perhaps have a Panasonic PV-DV950?
    If it is a Panasonic, according to the info on page 58 of the PV-DV950 Operating Instructions user manual, you should be able to connect to the Firewire (iLink® / iEEE 1394) port on the camera.
    More info about "PV" Panasonics here: http://docs.info.apple.com/article.html?artnum=113547
    Try double clicking buttons to see if that improves function?
    (3) In either case, no additional drivers or software are needed. Read your manual for hints on how to use your camera as a video source. Concentrate on how to record directly to a VCR from your camcorder, etc.
    Check for tape or head-saver operations. They may limit the functions you want. For example, Canons must be plugged into wall power. Some brands require that you remove tape for it to work. Some require that you leave the LCD view screen open in order for your camcorder to output its DV signal to Firewire. The manual will tell you.
    If nothing else works, unless you are willing to use a different camcorder or computer, try an alternate connector such as those suggested in my previous response.
    Message was edited by: EZ Jim
    Mac Pro Quad Core (Early 2009) 2.93Ghz Mac OS X (10.6.4); MacBook Pro (13 inch, Mid 2009) 2.26GHz (10.6.4)
    LED Cinema Display; G4 PowerBook 1.67GHz (10.4.11); iBookSE 366MHz (10.3.9); External iSight; iPod touch 4.1

  • How to use simple types for table column names ?

    Hi,
    can any one tell how to to use simple types for table column names?
    It is required in internationalizing of webdynpro applications.
    Regards,
    Rajesh

    Hi,
    1: define required column names in <SimpleType>
    2:use the following code to get those values
    3:bind 'text' property of Column headers to context attributes
    4:take a context attribute 'Value' as type of <SimpleType>
    5:set these values to context attributes
    IWDAttributeInfo objAttrInfo=wdContext.getNodeInfo().getAttribute(IPrivate<ViewName>View.IContextElement.VALUE);
    ISimpleTypeModifiable simple=objAttrInfo.getModifiableSimpleType();
    Map m=simple.getEnumerationTexts();
    Collection c=m.values();
    Iterator it=c.iterator();
    if(it.hasNext())
    wdContext.currentContextElement.set<att1>(it.next().toString);
    if(it.hasNext())
    wdContext.currentContextElement.set<att2>(it.next().toString);
    if(it.hasNext())
    wdContext.currentContextElement.set<att3>(it.next().toString);
    Regards
    LakshmiNarayana

  • How do I create a 'external table' against clob

    Hi there,
    I have a need, where I will have multiple csv files, which I plan to load it to a temporary table using the 'external table' concept. My issue is that I will have many at the same time and I don't want to create too many tables.
    So is there a way I can create tables against clob (which will have ',' separated data.
    Basically instead of putting the ',' separated data in a file I want to keep it in CLOB.
    Let me know
    Thanks

    Yes I understand that. Problem is I will be having lot of data so I need good indexes to process it. That's why I am loading into a permanent temp table.
    The issue is I have to load multiple csv files at the same time. So either I have to have multiple external tables defined or I have to single thread.
    So I was wondering if there is a way to replace the csv file with CLOB, that will be very useful.
    Thanks

Maybe you are looking for

  • How to print devlievery document with out condition record mess type

    Hi, Actually user want to take the sample print out  ( Hard copy ) of the delivery note and other documents for reference, even the message type processed, not processed and even ended with errors also I have written a program to display the delivery

  • How can I make a simple 1D array filter.

    When I aquire my data I get a 1D array with anywhere from 10 - 30 data points. There are always ten good data points the rest are noise or false triggeres. a good data point is in the range of .1-.2 a bad point is .001-.01 how can I filter out thse b

  • Help Making a Game Like Pokémon Trading Card Game.

    Hello! Im kinda new into making games in flash. And im trying hard to make a Game like the Pokemon TCG and i can't find anything on the internet that helps, so can't someone teach me how to do a game like that. Thanks!

  • Adding a custom field in a sap standard screen in pa30 for an infotype.

    Hi to all.. i'm in a requirement to add a custom field in a standard screen of pa30. for the infotype 0442. I googled up.. but i was not getting proper solution for it.. can any one provide a solution for it.. With regards. Aahbha.

  • OVS 3.2.1: Installing libvirt and/or virt tools (e.g., virt-install)

    Has anybody here successfully installed libvirt and/or virt-install on Oracle VM Server 3.2.1? I've attempted to install libvirt & virtinstall from source... [root@xen3 virtinst-0.600.3]# cd /usr/local/src/virtinst-0.600.3 [root@xen3 virtinst-0.600.3