Export to 'insert' spatial data

I use a database of the R1 11 g sqldeveloper - 1.1.3.with. I try to get the instructions for inserting a table that I loaded the Shapefile (including the SDO_GEOMETRY).

I get inert statements without any space as given below:
Insert in YOU (TRID, GEOM) values (100,'MDSYS.) SDO_GEOMETRY');

I use this method: make a right click on the table of the "tree of the Explorer of connections", select export data, and insert...

Y at - it another way to export the spatial data to insert sql.

Wells 1.1.3 is quite old, try upgrading to the latest version.

Tags: Database

Similar Questions

  • the insertion of the spatial data error

    Hi all

    I have a problem when the spatial data is inserted. could someone help me please to solve this.

    I created a table with spatial index.
    INSERT INTO USER_SDO_GEOM_METADATA
                VALUES('SDO_CA_test', 'CA', SDO_DIM_ARRAY(
                     MDSYS.SDO_DIM_ELEMENT ('LON', 71.19545, 120.35101, 0.000005),
                     MDSYS.SDO_DIM_ELEMENT ('LAT', 12.1145, 26.58041, 0.000005)), 8687);
           
         
         CREATE INDEX IO_CA_test ON SDO_CAR_test(CA)
        INDEXTYPE IS MDSYS.SPATIAL_INDEX PARAMETERS ('SDO_COMMIT_INTERVAL=10000 SDO_RTR_PCTFREE = 0');
    When I insert data from another spatail table that does not have a clue, I get an error.
    insert into sdo_ca_test as select * from base_sdo;
    
    ORA-29875 Failed in the ececution of the ODCINDEXINSERT routine
    
    ORA-13354 incorrect offset in ELEM_INFO_ARRAY
    ORA_06512 at MDSYS.SDO_INDEX_METHOD_101 line. 709
    I think that there are some incorrect data that are not with my index defination.

    How can I check these invalid data in base_sdo table. The base_sdo table has no index.

    Rgds
    SAZ

    Published by: Saaz Ena on December 21, 2009 18:16

    You can try SDO_GEOM. VALIDATE_GEOMETRY_WITH_CONTEXT
    or SDO_GEOM. VALIDATE_LAYER_WITH_CONTEXT? for example

    Select * from base_sdo where
    SDO_GEOM. VALIDATE_GEOMETRY_WITH_CONTEXT (a.CA, 0,000005). = "TRUE";

  • Creation of spatial data connectivity data

    Hello

    I have a few spatial data, which I'll try to describe the relevant aspects:

    -A LineSegment table, which contains information about cables, including the ID of the area (approximately 4 million lines)
    -An array of location, that contains a LineSegmentID (one by one), and a column (space) geometry (approximately 4 million lines).

    What I need to do, is to create a new table containing conceptual "nodes", containing the following columns:

    -NodeID (number)
    -(Number) LineSegmentID
    -LineSegmentEnd (1 or 2)

    So I need to prepare, for each cable, which other cable it connects, by comparing its ends with the endpoints of other cables in the same sector. A box contains cables up to 464. There are a total of 160 thousand areas.

    I'm working on the most effective way to achieve this, ideally by making a batch which will take less than half an hour. Oracle is relatively new to me, but I'm guessing that the right approach would be to use a series of intermediate (intermediate) tables, as I believe nested cursors would be much too slow (I ran a simple test to confirm this).

    I guess I'll have to get in a temporary table, the starting point and the end point of each cable using SDO_LRS. GEOM_SEGMENT_START_PT and SDO_LRS. GEOM_SEGMENT_END_PT, as well as the area ID. Join the table to itself, and then use SDO_GEOM. SDO_DISTANCE to work on what points are close together (for example less than one meter). However, I'm fighting to describe a step by step process.

    Anyone has any ideas that can help?

    (Oracle 11g)

    Examples of data to illustrate the problem:

    create table line_location (lineid number,
    geometry sdo_geometry);
    create table (ID, areaid) line;

    -a cable in the box 1, 2 in area 4, etc.
    insert into a values (1, 1) line;
    insert into values of line (2, 4);
    insert into values of line (3, 4);
    insert into a values (4, 3) line;
    insert into values of line (5, 3);
    insert into a values (6, 3) line;
    insert into values of line (7, 2);
    insert into values of line (8: 2);
    insert into a values (9, 2) line;
    insert into values of line (10, 2);

    -in reality, the lines are not necessarily straight and simple as these...
    insert into line_location values (1, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (10,1,10,4))); -zone 1
    insert into line_location values (2, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (3,9,5,9))); -zone 4
    insert into line_location values (3, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (5,9,5,10))); -zone 4
    insert into line_location values (4, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (1,1,2,1))); -zone 3
    insert into line_location values (5, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (2,3,2,1))); -zone 3
    insert into line_location values (6, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (2,3,3,3))); -zone 3
    insert into line_location values (7, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (5,3,5,4))); -zone 2
    insert into line_location values (8, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (4,4,5,4))); -zone 2
    insert into line_location values (9, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (5,9,6,4))); -zone 2
    insert into line_location values (10, MDSYS. SDO_GEOMETRY (2002,3785, NULL, MDSYS. SDO_ELEM_INFO_ARRAY (1,2,1), MDSYS. SDO_ORDINATE_ARRAY (5,7,5,9))); -zone 2

    create table node_line (node_id number,
    line_id number,
    endpoint_id number,--1 for starting point, 2 for the end point.
    area_id number
    );

    -expected here. If two lines are less than 0.5, whereas they should share a node.
    insert into node_line values (1, 1, 1, 1); -insulated cable in zone 1, starting point node
    insert into node_line values (2, 1, 2, 1); -insulated cable in zone 1, point endpoint node
    insert into node_line values (3, 2, 1, 4); -zone 4: 2, node starting point of cable
    insert into node_line values (4, 2, 2, 4); -zone 4, cable 2, point endpoint node
    insert into node_line values (4, 3, 1, 4); -point 2 = cable endpoint node cable 3 start knot, etc.
    insert into node_line values (5, 3, 2, 4);
    insert into node_line values (6, 4, 1, 3); -node at (1,1)
    insert into node_line values (7, 4, 2, 3); -node to (2.1)
    insert into node_line (8, 5, 1, 3) values; -node to (2,3)
    insert into node_line values (7, 5, 2, 3); -node to (2.1)
    insert into node_line (8, 6, 1, 3) values; -node to (2,3)
    insert into node_line values (9, 6, 2, 3); -(3.3) node
    insert into node_line values (10, 7, 1, 2); -node to (5.3)
    insert into node_line values (11, 7, 2, 2); -node to (5.4)
    insert into node_line (12, 7, 1, 2) values; -node to (4.4)
    insert into node_line values (11, 7, 2, 2); -node to (5.4)
    insert into node_line (13, 7, 1, 2) values; -node to (5.9)
    insert into node_line (14, 7, 2, 2) values; -node (6.4)
    insert into node_line values (15, 7, 1, 2); -node to (5,7)
    insert into node_line (13, 7, 2, 2) values; -node to (5.9)

    Thank you

    Hi Ronnie

    Have you had a look at the script on the old NET?
    This done in a slightly different result structure, what you're after.
    I took the time this morning to see a bit optimized.

    Below you will find the result.

    With clues about a couple and the use of the SDO_JOIN rather the sdo_relate this speeds up considerably.
    I had tested on a 600 k line objects (which is not 4 million I know) and is reasonable ok on my test (non optimized) environment.

    On the "1 metre" close to each other, I would have supported itself by setting the tolerance appropriately, so
    There should be no reason to perform within the distance checking. Obviously that permitting the resolution of your data.

    Have a look at.

    Note that the final table is different in their structure, but this needs to be easily adjusted in the script if your node_line table must be exactly like you defined.

    Luke

    -drop the existing SEQ_TOPO

    sequence of fall SEQ_TOPO;

    -create sequences with caching

    CREATE SEQ_TOPO CACHE 2000 SEQUENCES;

    commit;

    -drop temporary table

    drop table temp_nodes cascade constraints;

    -create temporary table and fill it with startponts and a field saying this are implemented, as X, Y, as we use it later to remove duplicates in a nonspatial way

    create the table temp_nodes

    as

    Select a.lineid, a.areaid, sdo_geometry (2001, a.node.sdo_srid, SDO_POINT (t.X, t.Y, null), null, null) as a node, SEQ_TOPO.nextval node_id, the from ' AS STEND, t.x, t.y

    Of

    (select lineid, areaid, node sdo_lrs.geom_segment_start_pt (geometry) of line_location, where the LINE line_location.lineid = line.line_id), TABLE (SDO_UTIL. GETVERTICES (a.Node)) t;

    commit;

    -Insert the end points in the temporary table

    insert into temp_nodes

    Select a.lineid, a.areaid, sdo_geometry (2001, a.node.sdo_srid, SDO_POINT (t.X, t.Y, null), null, null) as a node, SEQ_TOPO.nextval node_id, 'E' AS STEND, t.x, t.y

    Of

    (select lineid, areaid, node sdo_lrs.geom_segment_end_pt (geometry) of line_location, where the LINE line_location.lineid = line.line_id), TABLE (SDO_UTIL. GETVERTICES (a.Node)) t;

    commit;

    -insert user_sdo_geom_metadata and have created for temp_nodes index

    -adjust with appropriate metadata to srid, high and lowebounds values and the tolerance of your dataset

    -Here the tolerance is set at 1 meter, this way there is no need to use a distance, let tolerance help us here

    -Obviously this can work if tolerance is smaller, then the distance between the start and end of the link itself.

    delete from user_sdo_geom_metadata where table_name = 'TEMP_NODES ';

    INSERT INTO user_sdo_geom_metadata VALUES ("TEMP_NODES", "NODE", SDO_DIM_ARRAY (SDO_DIM_ELEMENT ('X', 0, 1000000, 1), SDO_DIM_ELEMENT ('Y', 0, 100000, 1)), 3785);

    -create spatial indexes with gtype = POINT to use internal optimization

    Drop index node_sx;

    CREATE INDEX node_sx ON temp_nodes (node) INDEXTYPE IS MDSYS. SPATIAL_INDEX PARAMETERS ('sdo_indx_dims = 2, layer_gtype = POINT');

    -create indexes on X, Y combination to accelerate "eliminating duplicates" (in the group by) is actually a "select unique" rather that remove duplicates

    CREATE INDEX INDEX1 ON TEMP_NODES (X, Y);

    CREATE the INDEX INDEX2 ON TEMP_NODES (node_id);

    -create the final node table with unique nodes of the temporary table, x, to y could be omitted

    create the table node_topo

    as

    Select a.nodeid, t.node, t.x, t.y

    Of

    (

    Select min (node_id) as nodeid

    Of

    temp_nodes

    Group x, Y

    ) an inner join

    temp_nodes t

    on (a.nodeid = t.node_id)

    ;

    commit;

    -insertion of metadata information

    delete from user_sdo_geom_metadata where table_name = 'NODE_TOPO ';

    INSERT INTO user_sdo_geom_metadata VALUES ("NODE_TOPO", "NODE", SDO_DIM_ARRAY (SDO_DIM_ELEMENT ('X', 0, 1000000, 1), SDO_DIM_ELEMENT ('Y', 0, 100000, 1)), 3785);

    -create spatial indexes on the table to end node with gtype = POINT (internal optimization)

    Drop index node_topo_sx;

    CREATE INDEX node_topo_sx ON NODE_TOPO (node) INDEXTYPE IS MDSYS. SPATIAL_INDEX PARAMETERS ('sdo_indx_dims = 2, layer_gtype = POINT');

    -create table node_link using SDO_JOIN between end node final tables and temp

    -the NAYINTERACT should take care of the "alignment" as the tolerance will be applied

    create the table node_line

    as

    Select lineid, max (st_ID) START_NODE_ID, max (en_ID) END_NODE_ID, max (areaid) AREAID

    Of

    (

    SELECT b.lineid, case when b.stend = s ' THEN a.nodeid 0 otherwise end st_ID,.

    cases where b.stend = 'E' THEN a.nodeid 0 otherwise end en_ID, areaid

    TABLE (SDO_JOIN ('NODE_TOPO', 'NODE',

    "TEMP_NODES", "NODE",

    "(masque = ANYINTERACT')) c,"

    node_topo has,

    temp_nodes b

    WHERE c.rowid1 = a.rowid AND c.rowid2 = b.rowid

    )

    Lineid group;

    commit;

    -items temp

    drop table temp_nodes cascade constraints;

    delete from user_sdo_geom_metadata where table_name = 'TEMP_NODES ';

    commit;

    seq_topo sequence of fall;

    commit;

  • As of the 31 version, why is there still no option of Thunderbird to insert the date and time in the message that you write?

    As of the 31 version, why is there still no option of Thunderbird to QUICKLY insert the date and time in the message that you write?

    Literally, saw this option very well needed - and opportunity-"promise" for three years now, and even if there are only one or two formats that could be used, at least the option is there.

    It seems that only is to bind a Macro, and the tool to Thunderbird and do it this way.

    Joe Rotello
    [email protected]
    Skype: joerotello

    If the installation of the add-on of TimeStamp is unacceptable for see you if there is a related add-on that you that you already might have managed to convince author to add your function. The Add on more for example has many variables that can enter the body of the message that get automatically replaced with the appropriate data when you merge a message.

  • Insert the date the doc is modified or printed

    Is it possible to insert the date of a document is modified or printed?  The function insert time / Date does not work.

    Thank you!

    Dick

    Pages is not a clone of Word and does not use the Word field codes. The answer is: no support for inserted date modified, or printed.

  • MapPoint 2010 Spatial data import

    Team,

    Can you please help currently using trial of 2013 has the same problem of spatial data import will import created since 2 weeks ESRI Shapefiles, but all newly created files or MapPoint 2010 today at present or if someone else creates will not matter.

    I get an error message:

    Error in Applysahpe properties

    Error number-2147217865

    Error Description The Mocrosoft Jet database engine object could not be found. "" "" NH1121 the file, try to open.

    Make sure that the objects exist.

    I tried to uninstall and reinstall both versions of Mappoint 2010 and Mappoint 2013 trial still open data 2 weeks ago but won't file since the last day little matter that someone creates or I create today. even remove the folder in Program files and cleaning of the folder %Temp%.

    Hello

    Check with the help of MapPoint and in the MapPoint Forums.

    Highway, Streets & Trips, MapPoint - Forum
    http://social.Microsoft.com/forums/is/streetsandtrips/threads

    MapPoint - Support
    http://www.Microsoft.com/MapPoint/en-us/support.aspx

    Support for MapPoint, streets & trips and Highway
    http://support.Microsoft.com/ph/851

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle=""><- mark="" twain="" said="" it="">

  • Insert the date and time in writing to the worksheet

    Simple question here

    I need save 4 data tables and insert the date and time at which it was taken (LV 8.6)

    for example

    04/09/09 10:00:01 4 6 7 2

    04/09/09 10:00:02 4 6 7 2

    04/09/09 10:00:03 4 6 7 2

    04/09/09 10:00:04 4 6 7 2

    Any ideas, I can't wire the right timestamp or date/time string in the table to create

    Thank you

    Chris

    Someone there doing the same thing that I am, I got it to work with the attached VI.

  • Problem with Sqlite when inserting huge data

    Hello world

    I am developing an app playbook, that need to store a lot of data, iam using the sqlite database,

    When iam trying to insert the data, it stopped insertion 263 every time, one did not get any exception or an error, can someone tell what is the problm

    Please someone answer me as soon as possible.

    Thank you.

    Try this

    protected  function getSqlConnection():SQLConnection{
    try
    {
    if (sqlConnection)
    return sqlConnection;
    var database:File =  File.documentsDirectory.resolvePath("xyz.db"));
    
    sqlConnection = new SQLConnection;
    sqlConnection.openAsync(database); //if you haven't already
    
    return sqlConnection;
    }
    
    private function addManyEntries():void {
    
    var sqlStatement:SQLStatement = new SQLStatement();
    var sql: String = "INSERT INTO abc(name, number) VALUES (@name, @number);";
    sqlStatement.text = sql;
    
    try {
    sqlConnection.begin();
    
    for (var i:uint = 0, j:int = 500; i < j; i++){
                            sqlStatement.parameters["@name"] = "Medicine " + i;
                            sqlStatement.parameters["@number"] = ""+Math.random()*99999;    //if it's a string
                            sqlStatement.execute();
                            sqlStatement.clearParameters();
                        }
    sqlConnection.commit(); 
    
    } catch (e:SQLError) {
                    trace(e);
                    sqlConnection.rollback();
                }
    
    }
    
  • How to insert CLOB data in tha table in my database

    I create a table called (annual NUMBER, name VARCHAR and CLOB doc) html page

    IsqlPlus I have run the following procedure


    P4_FIRE_HTML_TRIGGER_ARG EXEC ("OLBA + LEGAL + PSOA + OEJN", file);  file: came the CLOB parameter

    the result parameter is set to the queue:
    < ! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 / / IN" "http://..." >
    < HTML >
    < HEAD >
    < TITLE > ADDS - METARS results form < / TITLE >
    "< LINK REL ="StyleSheet"type =" text/css"HREF="/layout/awc/mystyle.css ">
    < / HEAD >
    < BODY BGCOLOR = "#FFFFFF" >
    < TABLE SUMMARY = "this table is used for formatting only" BORDER = 0 CELLPADDING = 3 CELLSPACING = 0 >
    < TR VALIGN = "top" >
    < TD ALIGN = "left" COLSPAN = "2" >
    < H2 > Aviation digital data Service (ADDS) < / H2 >
    Produced by form of METAR (1858 & #160;) 11 February 2014 UTC) < BR >
    " located at < A HREF =" http://AV .............................
    < Table >
    < /TR >
    < TR VALIGN = "top" >
    < TD ALIGN = "left" COLSPAN = "2" >
    < FONT FACE = "Monospace, Courier" > OLBA 111800Z 01006KT 7000 FEW026 16/11 Q1022 < / POLICE > < BR >
    < FONT FACE = "Monospace, Courier" > LEGAL 111830Z 34005KT 8000 NSC 13/11 Q1021 NOSIG < / POLICE > < BR >
    < FONT FACE = "Monospace, Courier" > PSOA 111830Z 21009KT 9999 - RA BKN016 06/03 Q1003 NOSIG < / POLICE > < BR >
    < FONT FACE = "Monospace, Courier" > OEJN 111800Z 34004KT CAVOK 25/20 Q1012 NOSIG < / POLICE > < BR >
    < Table >
    < /TR >
    < /table >
    < / BODY >
    < / HTML >

    I try inserting the above result in my HtmlPage of the table by a simple insert:
    Values inserted INTO HTMLPAGE (annual, doc)
    (5, 'meatr_taf', ' <!) DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 / / IN" "http://... "
    ... < / HTML > ') values are not inserted just I got a message:
    SP2-0863: iSQL * more treatment

    Can someone help me to insert CLOB data in my table HtmlPage above
    Thank you

    software:

    Form [32 bit] Version 9.0.2.9.0 (Production), oracle JInitiator: Version

    1.3.1.9, WebUtil Version 1.0.2 (Beta), window xp service pack 2 build 2600, Internet Explorer 8

    LOOP
    UTL_HTTP. READ_LINE (RESP, File_Metar, TRUE);
    p2_putlines (File_Metar);
    USING_CLOB. ADD_MORE (1, File_Metar);
    USING_CLOB. LOB_INS (1, 'Metar_taf', File_Metar);
    END LOOP;
    UTL_HTTP. END_RESPONSE (resp);

    You should not use USING_CLOB. LOB_INS (1, 'Metar_taf', File_Metar) inside the Loop.You must use

    LOOP

    UTL_HTTP. READ_LINE (RESP, File_Metar, TRUE);

    p2_putlines (File_Metar);

    USING_CLOB. ADD_MORE (1, File_Metar);

    END LOOP;

  • How can I insert a date on the signature line?

    How can I insert a date automatically on the signature line?

    Digital signature fields display the date and time when they were signed by default.

  • Insert XML data from the Table-&gt; back to null

    Dear Experts,

    -I have table xml as below:

    Example of CREATE TABLE (XML_spec XMLTYPE);

    Insert in the example
    Select ' < name of Message = "dataStaticInvestor" type = "IncomingMessage" >
    < name of field = "batchReference" > OPENINGBATCH000000 < / field > < List name = "data" >
    < = record name "data" >
    < name of field = "externalReference" > 01234567890aaaaaaa < / field >
    < name of field = "participantID" > OD001 < / field >
    < name of field = "participantName" > EQUITY SECURITIES INDONESIA, PT < / field >
    < / recording >
    < = record name "data" >
    < name of field = "externalReference" > 01234567890aaaaaaa < / field >
    < name of field = "participantID" > OD001 < / field >
    < name of field = "participantName" > EQUITY SECURITIES INDONESIA, PT < / field >
    < / recording >
    < = record name "data" >
    < name of field = "externalReference" > 01234567890aaaaaaa < / field >
    < name of field = "participantID" > OD001 < / field >
    < name of field = "participantName" > EQUITY SECURITIES INDONESIA, PT < / field >
    < / recording >
    < / list >
    < / message > ' double.

    Select * example;

    create table hasil1 (c1 varchar2 (500), c2 varchar2 (500), c3 varchar2 (500));

    -This step I create the procedure to insert xml data into the table as the batch.

    DECLARE
    x XmlType;
    BEGIN
    Select XML_SPEC in x for example;

    insert into hasil1
    SELECT
    p.Extract('/Record/Field/@externalReference').getstringval (C1),
    p.Extract('/Record/Field/@participantID').getstringval (C2),
    p.Extract('/Record/Field/@participantName').getstringval () as c3
    TABLE (XMLSequence (Extract(x,'Message/List/Record'))) p;
    commit;
    END;
    /

    -when the result of select hasil1, the output is back 3 rows and 3 columns, but all data is a null *.

    Best regards
    Sigcle

    You don't explain what output you need, but I guess something like this:

    SQL> insert into hasil1 (c1, c2, c3)
      2  select x.c1, x.c2, x.c3
      3  from example t
      4     , xmltable(
      5         'Message/List/Record'
      6         passing t.xml_spec
      7         columns c1 varchar2(500) path 'Field[@name="externalReference"]'
      8               , c2 varchar2(500) path 'Field[@name="participantID"]'
      9               , c3 varchar2(500) path 'Field[@name="participantName"]'
     10       ) x
     11  ;
    
    3 rows inserted
    
    SQL> select * from hasil1;
    
    C1                     C2        C3
    ---------------------- --------- --------------------------------
    01234567890aaaaaaa     OD001     EQUITY SECURITIES INDONESIA,PT
    01234567890aaaaaaa     OD001     EQUITY SECURITIES INDONESIA,PT
    01234567890aaaaaaa     OD001     EQUITY SECURITIES INDONESIA,PT
     
    
  • Error when inserting XML Date in the Table

    Hi all

    I am working on Oracle 11 g and trying to insert a date XML in the table but get error - below

    Query - insert into TableName (ID, CREATION, CREATEDBY) VALUES (50, *'2010 - 12-15 T 12: 57:19'*, 'Name')

    Error - java.sql.SQLDataException: ORA-01861: literal does not match the format string

    CREATED column datatype is Date

    When I try to use sysdate instead of hard-coding XML date of obtaining inserted successfully into the table. Please let me know how to pass this XML format date.

    Thanks in advance.

    Concerning
    Nikhil

    I don't see any XML in what you posted. In any case:

    "2010 12-15 T 12: 57:19'.

    is a string, not a date. Use:

    to_date('2010-12-15T12:57:19','YYYY-mm-dd"T"HH24:mi:SS')

    For example:

    SQL> create table tbl(created date);
    
    Table created.
    
    SQL> insert into tbl values('2010-12-15T12:57:19');
    insert into tbl values('2010-12-15T12:57:19')
                           *
    ERROR at line 1:
    ORA-01861: literal does not match format string
    
    SQL> insert into tbl values(to_date('2010-12-15T12:57:19','YYYY-MM-DD"T"HH24:MI:SS'))
      2  /
    
    1 row created.
    
    SQL> 
    

    SY.

  • Insert the date value in a table

    Hello

    I tried to update a table to insert the date in a date field. while I am running the query, it throws an error message like:

    "
    ORA-01830: date format picture ends before converting all of the input string
    01830.00000 - "date format picture ends before converting all of the input string.
    * Cause:
    * Action:
    "1830Error salesperson online: 1.


    My update query is added under:

    UPDATE PS_OBJCMTP_TMP SET LASTUPDOPRID = "PPLSOFT", LASTUPDDTTM = TO_DATE ('02-11 - 2002-12.14.09.000000 ',' YYYY-MM-DD - HH24.MI.) SS') WHERE OBJECTID1 = 3 AND OBJECTVALUE1 = 'EDIMAPPROPOP' AND OBJECTID2 = 0 AND OBJECTVALUE2 = '' AND OBJECTID3 = 0 AND OBJECTVALUE3 =' ' AND OBJECTID4 = 0 AND OBJECTVALUE4 = ' '



    someone tell me how to solve this problem.

    Simply speaking, you should cut ' 2002 - 02 - 11 - 12.14.09.000000'-' 2002 - 02 - 11 - 12.14.09'.
    RPAD('2002-02-11-12.14.09.000000',19)

  • CC of Dreamweaver insert a data object to a recordset navigation bar

    How can I insert a data object of a recordset navigation bar using Dreamweaver CC?  The Insert tab doesn't have a 'data' or 'data subject' to select?

    How is this work now in CC?

    With manual coding.  Or commercial extensions.

    http://www.DMXzone.com/3/Dreamweaver-extensions

    Nancy O.

  • Need to insert test data in all the tables that were present in a schema

    Hello

    I use Oracle 9i.

    10 tables were present in my current schema. All tables are not having all the records.

    I need to insert test data in each table using a single procedure. (the table name is inparameter for the procedure)

    For example, I test_emp, test_sal tables.

    CREATE TABLE test_emp (ename varchar2 (40), number of sal);
    CREATE TABLE test_sal (it NUMBER, rank NUMBER, will designate the NUMBER);

    I need to insert some test data in these tables. I shouldn't use utl_file or sql * loader for this.

    I tried below way.
    -- Incomplete code
    
    CREATE OR REPLACE PROCEDURE test_proc_insertdata(p_table_name IN VARCHAR2) IS
    
    BEGIN
    
      --Selected all the column_names, data_type, data_length into a collection variable from user_tab_columns.
    
      SELECT u.column_name, u.data_type, u.data_length
      --BULK COLLECT INTO l_col_tab
        FROM user_tab_columns u
       WHERE u.table_name = p_table_name;
    
      -- generated the values using below statement
      
        SELECT decode(u.DATA_TYPE,'VARCHAR2',dbms_random.string('A', u.data_length),'NUMBER',TRUNC(dbms_random.value(1, 5000)),'DATE',SYSDATE) val_list
        -- INTO collection varaible
          FROM user_tab_columns u
         WHERE TABLE_NAME = p_table_name;  
       
    
    END;
    I am not able to transmit these values to the collection dynamically to the INSERT statement. I tried many ways, but I am not satisfied with the code I've written.

    Please help me if you know a better idea.



    Thank you
    Suri

    Suri wrote:
    Hello

    I use Oracle 9i.

    10 tables were present in my current schema. All tables are not having all the records.

    I need to insert test data in each table using a single procedure. (the table name is inparameter for the procedure)

    For example, I test_emp, test_sal tables.

    CREATE TABLE test_emp (ename varchar2 (40), number of sal);
    CREATE TABLE test_sal (it NUMBER, rank NUMBER, will designate the NUMBER);

    I need to insert some test data in these tables. I shouldn't use utl_file or sql * loader for this.

    I tried below way.

    -- Incomplete code
    
    CREATE OR REPLACE PROCEDURE test_proc_insertdata(p_table_name IN VARCHAR2) IS
    
    BEGIN
    
    --Selected all the column_names, data_type, data_length into a collection variable from user_tab_columns.
    
    SELECT u.column_name, u.data_type, u.data_length
    --BULK COLLECT INTO l_col_tab
    FROM user_tab_columns u
    WHERE u.table_name = p_table_name;
    
    -- generated the values using below statement
    
    SELECT decode(u.DATA_TYPE,'VARCHAR2',dbms_random.string('A', u.data_length),'NUMBER',TRUNC(dbms_random.value(1, 5000)),'DATE',SYSDATE) val_list
    -- INTO collection varaible
    FROM user_tab_columns u
    WHERE TABLE_NAME = p_table_name;  
    
    END;
    

    I am not able to transmit these values to the collection dynamically to the INSERT statement. I tried many ways, but I am not satisfied with the code I've written.

    Please help me if you know a better idea.

    Thank you
    Suri

    With some effort, you can write dynamic insert queries. Read the data dictionary views ALL_TABLES and ALL_TAB_COLUMNS to get the data you need. You may need to limit the list to the tables you specify to hardcode the names of the tables. You can read the views for the information of table and column that you need generate the insert column orders. It will be a lot of work and it might be easier to simply hardcode values. Dynamic SQL is difficult to debug and work with: (.) Something like this (untested and totally undebugged)

    declare
      cursor v_tab_col(p_table_name) is select * from all_tab_columns where table_name = p_table_name;
      v_text varchar2(32767);
      v_table_name varchar2(30);
    begin
      v_table_name := 'DUAL';
      --chr(10) is a newline for readability when debugging
      v_text := 'insert into '||v_table_name||chr(10)||'(';
      --loop to build column list
      for v_tab_rec in v_tab_col loop
        --add comma if not first item in list
        if v_tab_col%rowcount > 1 then
          v_text := v_text ||',';
        end if;
        v_text := v_text || v_tab_rec.column_name;
      end loop;
      v_text := v_text ||') values ('||
      --loop to build column values
      for v_tab_rec in v_tab_cur loop
        if (v_tab_rec.datatype = 'VARCHAR2') then
          --add comma if not first item in list
          if v_tab_col%rowcount > 1 then
            v_text := v_text ||',';
          end if;
          if v_tab_rec.datatype = 'NUMBER' then
           v_text := v_text || '9';
           elsif v_tab_rec.datatype = 'VARCHAR2' then
             v_text := v_text ||'X';
          end if;
      end loop;
      v_text := v_text || ')';
      execute immediate v_text;
    end;
    

    This code is not effective, but shows how to do what you described. You'll have to code for all data types you need and find a way to take into account the primary/foreign keys, yourself. I leave it to you to find a way to avoid selecting the data twice ;)
    Good luck!

    Published by: riedelme on July 24, 2012 13:58

Maybe you are looking for