PL/SQL: converting VARCHAR2 version of a geometry into an mdsys.sdo_geometr

I'm writing some PL/SQL to parse through complex polygons and create new simple ones out of them. i.e. If i Have a multipolygon that contains 5 polygons, I want to produce 5 new polygons out of it. I'm generating the geometry as a varchar2 as I have some concatentaion to do and follow some logic.
Once I have this geometry created as a varchar2 how can i insert this as a geometry?
The following insert in PL/SQL
     insert into new_linestrings (id,geom,orig_id) values (se_new_linestrings.nextval,generated_geom,orig_id);
where generated_geom is a varchar2 generates the following error
26/2 PL/SQL: SQL Statement ignored
26/83 PL/SQL: ORA-00932: inconsistent datatypes: expected UDT got CHAR
And when I cast the varchar2 as a geometry like the following
     insert into new_linestrings (id,geom,orig_id) values (se_new_linestrings.nextval,cast (generated_geom as mdsys.sdo_geometry),orig_id);
I get the following error
ORA-00932: inconsistent datatypes: expected - got CHAR
ORA-06512: at "IVV.CREATE_GEOM", line 26
ORA-06512: at "IVV.CONVERT_TO_SIMPLE_LINES", line 26
ORA-06512: at line 1
How can i create a new geometry passing in a varchar2 in the constructor?
Thanks
Paul

You can do this by creating a string which is the full sql statement
and the executing it in PL/SQL.
For example, you have str1 := 'SDO_GEOMETRY(2006, 600000, NULL, SDO_ELEM_INFO_ARRAY(1, 2, 1, 13, 2, 1), SDO_ORDINATE_ARRAY(196741, 219623, 196743, 219623, 196745, 219623, 196746, 219637, 196742, 219639, 196741, 219623, 196746, 219637, 196746, 219637, 196746, 219637, 196746, 219637)) ';
Then make a SQL statement like this:
str2 := 'INSERT INTO new_linestrings (id,geom,orig_id) values ' || '('|| to_char(se_new_linestrings.nextval)|| ', ' ||str1|| ', ' ||to_char(orig_id) ') ';
execute immediate str2;
====
you may have to read in se_new_linestrings.nextval to a local variable
first.
siva

Similar Messages

  • Product keys to convert evaluation version of SQL Server Std 2014 to their SQL Server Standard 2014 Volume License

    Customer was asked for a product key to convert      evaluation version of SQL Server Std 2014 to their SQL Server Standard      2014
    Volume License.
    He cannot download the ISO as he is on a sterile server      on his client’s site.

    You may also try and look for PID in to DefaultSetup.ini file in the installation media, which can be found by going to the root folder of the SQL Server set media
    on the server or on the DVD, then look for this file in either the x64 or x86 folder.
    Keerthi Deep | Blog SQLServerF1 |
    Facebook

  • Dbms_sql.parse: varchar2a version does NOT throw ORA-24344

    I'm trying to execute some generated code in 10.2. using the varchar2a version of dbms_sql.parse.
    This works fine, but when the there is something wrong in the generated code, I do not get an exception (I do get it with the varchar2 version).
    So when I run the following example, the first call to dbms_sql.parse creates an invalid package, but only the second call will actually throw an exception:
    DECLARE
      v_cur INTEGER;
      v_sql dbms_sql.varchar2a;
    BEGIN
      v_cur := DBMS_SQL.open_cursor;
      v_sql(1) := 'CREATE OR REPLACE PACKAGE xxx AS a ###; END;'; -- invalid SQL
      dbms_sql.parse(v_cur, v_sql, 1, 1, FALSE, dbms_sql.native);
      dbms_output.put_line ('ERROR: should have failed');
      dbms_sql.parse(v_cur, v_sql(1), dbms_sql.native);
      dbms_sql.close_cursor(v_cur);
    EXCEPTION
      WHEN OTHERS THEN
        dbms_sql.close_cursor( v_cur );
        dbms_output.put_line ('OK: ' || SQLERRM );
    END;
    Can anybody reproduce/explain this?
    Thanks!

    Here is the code I am running ...
    CREATE OR REPLACE PROCEDURE p_sql_valid_or_not_cnt
    (vSQL IN VARCHAR2, vValid OUT NUMBER, vMessage OUT VARCHAR2, vCount OUT NUMBER) IS
    -- Purpose: Returns 0 in vvalid if SQL is valid, else returns -1. Returns row count when SQL is valid.
    -- Parameters:
    -- IN : vSQL
    -- OUT : vValid
    -- OUT : vMessage
    -- OUT : vCount
    cur INTEGER := DBMS_SQL.OPEN_CURSOR;
    fdbk INTEGER;
    BEGIN
    DBMS_SQL.PARSE (cur, vSQL, DBMS_SQL.NATIVE);
    fdbk := DBMS_SQL.EXECUTE (cur);
    vCount := 0;
    LOOP /* Fetch next row. Exit when done. */
    EXIT WHEN DBMS_SQL.FETCH_ROWS (cur) = 0;
    vCount := vCount + 1;
    END LOOP;
    vValid := 0;
    vMessage := 'No errors';
    DBMS_SQL.CLOSE_CURSOR (cur);
    END p_sql_valid_or_not_cnt;
    To run ...
    set serveroutput on
    declare
    i number;
    m varchar2(500);
    c number;
    begin
    p_sql_valid_or_not_cnt('SELECT * FROM TAB where 1 <> 1',i,m,c);
    DBMS_OUTPUT.PUT_LINE(i);
    DBMS_OUTPUT.PUT_LINE(m);
    DBMS_OUTPUT.PUT_LINE(c);
    end;
    This runs fine.
    But when I try to access an object from a remote server using DB link. I get the error ...
    set serveroutput on
    declare
    i number;
    m varchar2(500);
    c number;
    begin
    p_sql_valid_or_not_cnt('SELECT * FROM REMOTE_SCHEMA.T_REMOTE@REMOTE_SERVER where 1 <> 1',i,m,c);
    DBMS_OUTPUT.PUT_LINE(i);
    DBMS_OUTPUT.PUT_LINE(m);
    DBMS_OUTPUT.PUT_LINE(c);
    end;
    declare
    ERROR at line 1:
    ORA-24374: define not done before fetch or execute and fetch
    ORA-06512: at "SYS.DBMS_SYS_SQL", line 1125
    ORA-06512: at "SYS.DBMS_SQL", line 328
    ORA-06512: at "IMEPAS.P_SQL_VALID_OR_NOT_CNT", line 16
    ORA-06512: at line 6
    I can run the SQL that I am passing as vSQL directly in SQLPLUS ...
    This code in itself works.
    SELECT * FROM
    REMOTE_SCHEMA.T_REMOTE@REMOTE_SERVER
    where 1 <> 1;
    The user I am using to logon to my server is also there on REMOTE_SERVER.
    The DB LINK is created by CONNECTED USER option. The user on REMOTE_SERVER has explict select access on the table (not via role) I am accessing.
    Any help would be much appreciated.

  • How to bridge (fill) gaps when converting a 2006 geometry  into a 2002 geometry

    Is it at all possible to bridge (fill) gaps when converting a 2006 geometry into a single 2002 geometry. I have a solution for the conversion from 2006 to 2002 provided by BHall but upon further investigation investigation of my dataset some of the multi line polygons have gaps which I need to fill and I am not sure how to go about this.
    Here is a simple example of what I am trying to achieve
    Before
    SELECT (sdo_geometry(2006, 81989, NULL,
                    mdsys.sdo_elem_info_array(1,2,1,5,2,1,9,2,1,13,2,1),
                    mdsys.sdo_ordinate_array(16,0.999,16.998,-0.001,17.253,-0.001,18.003,0.999,18.003,0.999,19.001,0.999,19.001,0.999,19.999,-0.001)))
      FROM dual
    After
    SELECT (sdo_geometry(2006, 81989,NULL,
                   mdsys.sdo_elem_info_array(1,2,1),
                   mdsys.sdo_ordinate_array(16,0.999,17.253,-0.001,18.003,0.999,19.001,0.999,19.999,-0.001))) FROM dual    
    Thanks in advance

    Okay Roché,
    You might need to break this problem down into smaller parts for the forum.  All your examples show the gap being replaced by a single vertice - e.g. you want to "snap" the gap together.  I'd suggest this is just complicating your question.  Once the gap is filled (with a line) then you can run SDO_UTIL.REMOVE_DUPLICATE_VERTICES afterwards to remove the new line if its below your tolerance.  I think that Bryan's code wrapped in remove duplicate vertices will solve your second scenario.  But overall I think it would be helpful to focus just on the filling and leave the snapping for a follow-up question.
    So back to scenario #1, below is some code I wrote a while back that might do what you want or at least get you started.     Note that the input must be a multistring and the multistring cannot be "spaghetti".  In other words each line in the multistring must be disjoint or at most touch other lines only at endpoints. The goal is to sift through the lines and create a single linestring using the smallest gaps.  It's not subtle and will indeed produce bad geometries if the inputs are setup in an impossible manner.  There are also some rare geodetic bugs with SDO_GEOM.RELATE that crop up.  So you'll note I test both distance and relate in some places.  That's intentional though kind of dumb.
    Hopefully this helps.  If you improve the code please shoot a copy back to me.
    Cheers,
    Paul   
    CREATE OR REPLACE PACKAGE dz_gap_fill
    AUTHID CURRENT_USER
    AS
       FUNCTION linear_gap_filler(
           p_input            IN  MDSYS.SDO_GEOMETRY
          ,p_tolerance        IN  NUMBER DEFAULT 0.05
       ) RETURN MDSYS.SDO_GEOMETRY;
    END dz_gap_fill;
    CREATE OR REPLACE PACKAGE BODY dz_gap_fill
    AS
       FUNCTION fast_point(
           p_x             IN  NUMBER
          ,p_y             IN  NUMBER
          ,p_z             IN  NUMBER DEFAULT NULL
          ,p_m             IN  NUMBER DEFAULT NULL
          ,p_srid          IN  NUMBER DEFAULT 8265
       ) RETURN MDSYS.SDO_GEOMETRY
       AS
       BEGIN
          -- Step 10
          -- Check over incoming parameters
          IF p_x IS NULL
          OR p_y IS NULL
          THEN
             RAISE_APPLICATION_ERROR(-20001,'x and y cannot be NULL');
          END IF;
          -- Step 20
          -- Do the simplest solution first
          IF  p_z IS NULL
          AND p_m IS NULL
          THEN
             RETURN SDO_GEOMETRY(
                 2001
                ,p_srid
                ,SDO_POINT_TYPE(
                     p_x
                    ,p_y
                    ,NULL
                ,NULL
                ,NULL
          END IF;
          -- Step 30
          -- Do the other wilder choices
          IF p_z IS NULL
          AND p_m IS NOT NULL
          THEN
             RETURN SDO_GEOMETRY(
                 3301
                ,p_srid
                ,SDO_POINT_TYPE(
                     p_x
                    ,p_y
                    ,p_m
                ,NULL
                ,NULL
          ELSIF p_z IS NOT NULL
          AND   p_m IS NULL
          THEN
             RETURN SDO_GEOMETRY(
                 3001
                ,p_srid
                ,SDO_POINT_TYPE(
                     p_x
                    ,p_y
                    ,p_z
                ,NULL
                ,NULL
          ELSIF p_z IS NOT NULL
          AND   p_m IS NOT NULL
          THEN
             RETURN SDO_GEOMETRY(
                 4401
                ,p_srid
                ,NULL
                ,SDO_ELEM_INFO_ARRAY(1,1,1)
                ,SDO_ORDINATE_ARRAY(p_x,p_y,p_z,p_m)
          ELSE
             RAISE_APPLICATION_ERROR(-20001,'ERR!');
          END IF;
       END fast_point;
       FUNCTION get_start_point(
          p_input        IN  MDSYS.SDO_GEOMETRY
       ) RETURN MDSYS.SDO_GEOMETRY
       AS
          int_dims PLS_INTEGER;
          int_gtyp PLS_INTEGER;
          int_lrs  PLS_INTEGER;
       BEGIN
          -- Step 10
          -- Check over incoming parameters
          IF p_input IS NULL
          THEN
             RETURN NULL;
          END IF;
          -- Step 20
          -- Gather information about the geometry
          int_dims := p_input.get_dims();
          int_gtyp := p_input.get_gtype();
          int_lrs  := p_input.get_lrs_dim();
          -- Step 30
          -- Handle point and multipoint inputs
          IF int_gtyp = 1
          THEN
             RETURN p_input;
          ELSIF int_gtyp = 5
          THEN
             RETURN SDO_UTIL.EXTRACT(p_input,1);
          END IF;
          -- Step 40
          -- Return results
          IF int_dims = 2
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(1)
                ,p_input.SDO_ORDINATES(2)
                ,NULL
                ,NULL
                ,p_input.SDO_SRID
          ELSIF  int_dims = 3
          AND int_lrs = 3
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(1)
                ,p_input.SDO_ORDINATES(2)
                ,NULL
                ,p_input.SDO_ORDINATES(3)
                ,p_input.SDO_SRID
          ELSIF  int_dims = 3
          AND int_lrs = 0
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(1)
                ,p_input.SDO_ORDINATES(2)
                ,p_input.SDO_ORDINATES(3)
                ,NULL
                ,p_input.SDO_SRID
          ELSIF  int_dims = 4
          AND int_lrs IN (4,0)
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(1)
                ,p_input.SDO_ORDINATES(2)
                ,p_input.SDO_ORDINATES(3)
                ,p_input.SDO_ORDINATES(4)
                ,p_input.SDO_SRID
          ELSIF  int_dims = 4
          AND int_lrs = 3
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(1)
                ,p_input.SDO_ORDINATES(2)
                ,p_input.SDO_ORDINATES(4)
                ,p_input.SDO_ORDINATES(3)
                ,p_input.SDO_SRID
          ELSE
             RAISE_APPLICATION_ERROR(-20001,'ERR!');
          END IF;
       END get_start_point;
       FUNCTION get_end_point(
          p_input        IN  MDSYS.SDO_GEOMETRY
       ) RETURN MDSYS.SDO_GEOMETRY
       AS
          int_dims PLS_INTEGER;
          int_gtyp PLS_INTEGER;
          int_lrs  PLS_INTEGER;
          int_len  PLS_INTEGER;
       BEGIN
          -- Step 10
          -- Check over incoming parameters
          IF p_input IS NULL
          THEN
             RETURN NULL;
          END IF;
          -- Step 20
          -- Gather information about the geometry
          int_dims := p_input.get_dims();
          int_gtyp := p_input.get_gtype();
          int_lrs  := p_input.get_lrs_dim();
          int_len  := p_input.SDO_ORDINATES.COUNT();
          -- Step 30
          -- Handle point and multipoint inputs
          IF int_gtyp = 1
          THEN
             RETURN p_input;
          ELSIF int_gtyp = 5
          THEN
             RETURN SDO_UTIL.EXTRACT(
                 p_input
                ,SDO_UTIL.GETNUMELEM(p_input)
          END IF;
          -- Step 40
          -- Return results
          IF int_dims = 2
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(int_len - 1)
                ,p_input.SDO_ORDINATES(int_len)
                ,NULL
                ,NULL
                ,p_input.SDO_SRID
          ELSIF  int_dims = 3
          AND int_lrs = 3
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(int_len - 2)
                ,p_input.SDO_ORDINATES(int_len - 1)
                ,NULL
                ,p_input.SDO_ORDINATES(int_len)
                ,p_input.SDO_SRID
          ELSIF  int_dims = 3
          AND int_lrs = 0
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(int_len - 2)
                ,p_input.SDO_ORDINATES(int_len - 1)
                ,p_input.SDO_ORDINATES(int_len)
                ,NULL
                ,p_input.SDO_SRID
          ELSIF  int_dims = 4
          AND int_lrs IN (4,0)
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(int_len - 3)
                ,p_input.SDO_ORDINATES(int_len - 2)
                ,p_input.SDO_ORDINATES(int_len - 1)
                ,p_input.SDO_ORDINATES(int_len)
                ,p_input.SDO_SRID
          ELSIF  int_dims = 4
          AND int_lrs = 3
          THEN
             RETURN fast_point(
                 p_input.SDO_ORDINATES(int_len - 3)
                ,p_input.SDO_ORDINATES(int_len - 2)
                ,p_input.SDO_ORDINATES(int_len)
                ,p_input.SDO_ORDINATES(int_len - 1)
                ,p_input.SDO_SRID
          ELSE
             RAISE_APPLICATION_ERROR(-20001,'ERR!');
          END IF;
       END get_end_point;
       FUNCTION is_spaghetti(
           p_input             IN  MDSYS.SDO_GEOMETRY
          ,p_tolerance         IN  NUMBER DEFAULT 0.05
       ) RETURN VARCHAR2
       AS
          num_tolerance    NUMBER := p_tolerance;
          ary_strings      MDSYS.SDO_GEOMETRY_ARRAY := MDSYS.SDO_GEOMETRY_ARRAY();
          ary_starts       MDSYS.SDO_GEOMETRY_ARRAY := MDSYS.SDO_GEOMETRY_ARRAY();
          ary_ends         MDSYS.SDO_GEOMETRY_ARRAY := MDSYS.SDO_GEOMETRY_ARRAY();
          int_count        PLS_INTEGER;
          ary_start_count  MDSYS.SDO_NUMBER_ARRAY := MDSYS.SDO_NUMBER_ARRAY();
          ary_end_count    MDSYS.SDO_NUMBER_ARRAY := MDSYS.SDO_NUMBER_ARRAY();
          ary_inside_count MDSYS.SDO_NUMBER_ARRAY := MDSYS.SDO_NUMBER_ARRAY();
       BEGIN
          -- Step 10
          -- Check over incoming parameters
          IF p_input IS NULL
          THEN
             RETURN NULL;
          ELSIF p_input.get_gtype = 2
          THEN
             RETURN 'FALSE';
          ELSIF p_input.get_gtype <> 6
          THEN
             RAISE_APPLICATION_ERROR(-20001,'input gtype must be 2 or 6');
          END IF;
          IF num_tolerance IS NULL
          THEN
             num_tolerance := 0.05;
          END IF;
          -- Step 20
          -- Break multistring into single linestrings with nodes
          int_count := SDO_UTIL.GETNUMELEM(p_input);
          ary_strings.EXTEND(int_count);
          ary_starts.EXTEND(int_count);
          ary_ends.EXTEND(int_count);
          ary_start_count.EXTEND(int_count);
          ary_end_count.EXTEND(int_count);
          ary_inside_count.EXTEND(int_count);
          FOR i IN 1 .. int_count
          LOOP
             ary_strings(i) := SDO_UTIL.EXTRACT(p_input,i);
             ary_starts(i)  := get_start_point(ary_strings(i));
             ary_ends(i)    := get_end_point(ary_strings(i));
          END LOOP;
          -- Step 30
          -- Loop through and count the nodes connections
          FOR i IN 1 .. int_count
          LOOP
             ary_start_count(i)  := 0;
             ary_end_count(i)    := 0;
             ary_inside_count(i) := 0;
             FOR j IN 1 .. int_count
             LOOP
                IF i != j
                THEN
                   IF SDO_GEOM.RELATE(
                      ary_starts(i),
                      'DETERMINE',
                      ary_strings(j),
                      num_tolerance
                   ) IN ('TOUCH','CONTAINS','COVERS','ON')
                   THEN
                      ary_start_count(i) := ary_start_count(i) + 1;
                   ELSIF SDO_GEOM.RELATE(
                      ary_ends(i),
                      'DETERMINE',
                      ary_strings(j),
                      num_tolerance
                   ) IN ('TOUCH','CONTAINS','COVERS','ON')
                   THEN
                      ary_end_count(i) := ary_end_count(i) + 1;
                   ELSIF SDO_GEOM.RELATE(
                      ary_strings(i),
                      'DETERMINE',
                      ary_strings(j),
                      num_tolerance
                   ) IN ('TOUCH','CONTAINS','COVERS','OVERLAPBYINTERSECT')
                   THEN
                      ary_inside_count(i) := ary_inside_count(i) + 1;
                   END IF;
                END IF;
             END LOOP;
             IF ary_start_count(i) > 1
             OR ary_end_count(i) > 1
             OR ary_inside_count(i) > 0
             THEN
                RETURN 'TRUE';
             END IF;
          END LOOP;
          RETURN 'FALSE';
       END is_spaghetti;
       FUNCTION points2segment(
           p_point_one              IN  MDSYS.SDO_POINT_TYPE
          ,p_point_two              IN  MDSYS.SDO_POINT_TYPE
          ,p_srid                   IN  NUMBER
       ) RETURN MDSYS.SDO_GEOMETRY
       AS
       BEGIN
          IF ( p_point_one.Z IS NULL AND p_point_two.Z IS NOT NULL )
          OR ( p_point_one.Z IS NOT NULL AND p_point_two.Z IS NULL )
          THEN
             RAISE_APPLICATION_ERROR(
                -20001,
                'both points must have the same number of dimensions, point_one Z is ' ||
                NVL(TO_CHAR(p_point_one.Z),'') ||
                ' and point_two Z is ' ||
                NVL(TO_CHAR(p_point_two.Z),'')
          END IF;
          IF p_point_one.Z IS NULL
          THEN
             RETURN SDO_GEOMETRY(
                 2002
                ,p_srid
                ,NULL
                ,SDO_ELEM_INFO_ARRAY(1,2,1)
                ,SDO_ORDINATE_ARRAY(p_point_one.X,p_point_one.Y,p_point_two.X,p_point_two.Y)
          ELSE
             RETURN SDO_GEOMETRY(
                 3002
                ,p_srid
                ,NULL
                ,SDO_ELEM_INFO_ARRAY(1,2,1)
                ,SDO_ORDINATE_ARRAY(p_point_one.X,p_point_one.Y,p_point_one.Z,p_point_two.X,p_point_two.Y,p_point_two.Z)
          END IF;
       END points2segment;
       FUNCTION points2segment(
           p_point_one              IN  MDSYS.SDO_GEOMETRY
          ,p_point_two              IN  MDSYS.SDO_GEOMETRY
       ) RETURN MDSYS.SDO_GEOMETRY
       AS
          int_gtype1 PLS_INTEGER;
          int_dims1  PLS_INTEGER;
          int_gtype2 PLS_INTEGER;
          int_dims2  PLS_INTEGER;
          point_one  MDSYS.SDO_POINT_TYPE;
          point_two  MDSYS.SDO_POINT_TYPE;
       BEGIN
          int_gtype1 := p_point_one.get_gtype();
          int_dims1  := p_point_one.get_dims();
          int_gtype2 := p_point_two.get_gtype();
          int_dims2  := p_point_two.get_dims();
          IF  int_gtype1 = 1
          AND int_gtype2 = 1
          AND int_dims1  = int_dims2
          AND p_point_one.SDO_SRID = p_point_two.SDO_SRID
          THEN
             NULL;  -- Good
          ELSE
             RAISE_APPLICATION_ERROR(
                 -20001
                ,'both point objects must be points and have the same number of dimensions and SRIDs'
          END IF;
          IF int_dims1 = 4
          THEN
             RETURN SDO_GEOMETRY(
                 4402
                ,p_point_one.SDO_SRID
                ,NULL
                ,SDO_ELEM_INFO_ARRAY(1,2,1)
                ,SDO_ORDINATE_ARRAY(
                     p_point_one.SDO_ORDINATES(1)
                    ,p_point_one.SDO_ORDINATES(2)
                    ,p_point_one.SDO_ORDINATES(3)
                    ,p_point_one.SDO_ORDINATES(4)
                    ,p_point_two.SDO_ORDINATES(1)
                    ,p_point_two.SDO_ORDINATES(2)
                    ,p_point_two.SDO_ORDINATES(3)
                    ,p_point_two.SDO_ORDINATES(4)
          ELSE
             -- Use the sdo_point_type method for the rest
             IF p_point_one.SDO_POINT IS NOT NULL
             THEN
                point_one := p_point_one.SDO_POINT;
             ELSE
                IF int_dims1 = 3
                THEN
                   point_one := SDO_POINT_TYPE(
                       p_point_one.SDO_ORDINATES(1)
                      ,p_point_one.SDO_ORDINATES(2)
                      ,p_point_one.SDO_ORDINATES(3)
                ELSE
                   point_one := SDO_POINT_TYPE(
                       p_point_one.SDO_ORDINATES(1)
                      ,p_point_one.SDO_ORDINATES(2)
                      ,NULL
                END IF;
             END IF;
             IF p_point_two.SDO_POINT IS NOT NULL
             THEN
                point_two := p_point_two.SDO_POINT;
             ELSE
                IF int_dims1 = 3
                THEN
                   point_two := SDO_POINT_TYPE(
                        p_point_two.SDO_ORDINATES(1)
                       ,p_point_two.SDO_ORDINATES(2)
                       ,p_point_two.SDO_ORDINATES(3)
                ELSE
                   point_two := SDO_POINT_TYPE(
                       p_point_two.SDO_ORDINATES(1)
                      ,p_point_two.SDO_ORDINATES(2)
                      ,NULL
                END IF;
             END IF;
             RETURN points2segment(
                 p_point_one   => point_one
                ,p_point_two   => point_two
                ,p_srid        => p_point_one.SDO_SRID
          END IF;
       END points2segment;
       FUNCTION linear_gap_filler(
           p_input            IN  MDSYS.SDO_GEOMETRY
          ,p_tolerance        IN  NUMBER DEFAULT 0.05
       ) RETURN MDSYS.SDO_GEOMETRY
       AS
          sdo_input     MDSYS.SDO_GEOMETRY := p_input;
          num_tolerance NUMBER;
          int_counter   PLS_INTEGER;
          ary_edges     MDSYS.SDO_GEOMETRY_ARRAY;
          ary_starts    MDSYS.SDO_GEOMETRY_ARRAY;
          ary_ends      MDSYS.SDO_GEOMETRY_ARRAY;
          ary_nearest   MDSYS.SDO_NUMBER_ARRAY;
          ary_distance  MDSYS.SDO_NUMBER_ARRAY;
          num_temp      NUMBER;
          num_nearest   NUMBER;
          int_winner    PLS_INTEGER;
          int_winner2   PLS_INTEGER;
          sdo_point1    MDSYS.SDO_GEOMETRY;
          sdo_point2    MDSYS.SDO_GEOMETRY;
          boo_done      BOOLEAN;
          num_one       NUMBER;
          num_two       NUMBER;
          int_looper    PLS_INTEGER := 1;
       BEGIN
          -- Step 10
          -- Check over incoming parameters
          IF num_tolerance IS NULL
          THEN
             num_tolerance := 0.05;
          END IF;
          IF sdo_input IS NULL
          OR sdo_input.get_gtype() <> 6
          THEN
             RETURN sdo_input;
          END IF;
          IF is_spaghetti(sdo_input,p_tolerance) = 'TRUE'
          THEN
             RETURN sdo_input;
          END IF;
          <>      ary_edges     := MDSYS.SDO_GEOMETRY_ARRAY();
          ary_starts    := MDSYS.SDO_GEOMETRY_ARRAY();
          ary_ends      := MDSYS.SDO_GEOMETRY_ARRAY();
          ary_nearest   := MDSYS.SDO_NUMBER_ARRAY();
          ary_distance  := MDSYS.SDO_NUMBER_ARRAY();
          -- Step 20
          -- Break multistring into edges and start and end nodes
          int_counter := SDO_UTIL.GETNUMELEM(sdo_input);     
          ary_edges.EXTEND(int_counter);
          ary_starts.EXTEND(int_counter);
          ary_ends.EXTEND(int_counter);
          FOR i IN 1 .. int_counter
          LOOP 
             ary_edges(i)  := SDO_UTIL.EXTRACT(sdo_input,i);
             ary_starts(i) := get_start_point(ary_edges(i));
             ary_ends(i)   := get_end_point(ary_edges(i));
          END LOOP;
          -- Step 30
          -- Determine the closest endpoints
          ary_nearest.EXTEND(int_counter);
          ary_distance.EXTEND(int_counter);
          FOR i IN 1 .. int_counter
          LOOP
             num_nearest := NULL;
             int_winner := NULL;
             FOR j IN 1 .. int_counter
             LOOP
                IF j != i
                THEN
                   num_temp := SDO_GEOM.SDO_DISTANCE(
                       ary_edges(i)
                      ,ary_edges(j)
                      ,num_tolerance
                   IF num_nearest IS NULL
                   OR num_temp < num_nearest
                   THEN
                      num_nearest := num_temp;
                      int_winner := j;
                   END IF;
                END IF;
             END LOOP;
             ary_nearest(i) := int_winner;
             ary_distance(i) := num_nearest;
          END LOOP;
          -- Step 40
          -- Find the smallest gap
          int_winner := NULL;
          num_nearest := NULL;
          FOR i IN 1 .. int_counter
          LOOP
             IF num_nearest IS NULL
             OR ary_distance(i) < num_nearest
             THEN
                 int_winner := i;
                 num_nearest := ary_distance(i);
                 int_winner2 := ary_nearest(i);
             END IF;
          END LOOP;
          -- Step 50
          -- Determine the endpoints to connect
          num_one := SDO_GEOM.SDO_DISTANCE(
             get_start_point(ary_edges(int_winner)),
             ary_edges(int_winner2),
             num_tolerance
          num_two := SDO_GEOM.SDO_DISTANCE(
             get_end_point(ary_edges(int_winner)),
             ary_edges(int_winner2),
             num_tolerance
          IF ( num_one = 0 AND SDO_GEOM.RELATE(
             get_start_point(ary_edges(int_winner)),
             'ANYINTERACT',
             ary_edges(int_winner2),
             num_tolerance
          ) = 'TRUE' )
          OR ( num_two = 0 AND SDO_GEOM.RELATE(
             get_end_point(ary_edges(int_winner)),
             'ANYINTERACT',
             ary_edges(int_winner2),
             num_tolerance
          ) = 'TRUE' )
          THEN
             sdo_point1 := NULL;
          ELSIF num_one < num_two
          THEN
             sdo_point1 := get_start_point(ary_edges(int_winner));
          ELSE
             sdo_point1 := get_end_point(ary_edges(int_winner));
          END IF;
          num_one := SDO_GEOM.SDO_DISTANCE(
             get_start_point(ary_edges(int_winner2)),
             ary_edges(int_winner),
             num_tolerance
          num_two := SDO_GEOM.SDO_DISTANCE(
             get_end_point(ary_edges(int_winner2)),
             ary_edges(int_winner),
             num_tolerance
          IF ( num_one = 0 AND SDO_GEOM.RELATE(
             get_start_point(ary_edges(int_winner2)),
             'ANYINTERACT',
             ary_edges(int_winner),
             num_tolerance
          ) = 'TRUE' )
          OR ( num_two = 0 AND SDO_GEOM.RELATE(
             get_end_point(ary_edges(int_winner2)),
             'ANYINTERACT',
             ary_edges(int_winner),
             num_tolerance
          ) = 'TRUE' )
          THEN
             sdo_point2 := NULL;
          ELSIF num_one < num_two
          THEN
             sdo_point2 := get_start_point(ary_edges(int_winner2));
          ELSE
             sdo_point2 := get_end_point(ary_edges(int_winner2));
          END IF;
          -- Step 50
          -- Smash together
          IF sdo_point1 IS NULL
          OR sdo_point2 IS NULL
          THEN
             sdo_input := SDO_UTIL.CONCAT_LINES(
                ary_edges(int_winner),
                ary_edges(int_winner2)
          ELSE
             sdo_input := SDO_UTIL.CONCAT_LINES(
                SDO_UTIL.CONCAT_LINES(
                   ary_edges(int_winner),
                   points2segment(sdo_point1,sdo_point2)
                ary_edges(int_winner2)
          END IF;
          boo_done := TRUE;
          FOR i IN 1 .. int_counter
          LOOP
             IF i NOT IN (int_winner,int_winner2)
             THEN
                sdo_input := SDO_UTIL.APPEND(sdo_input,ary_edges(i));
                boo_done := FALSE;
             END IF;
          END LOOP;
          -- Step 60
          -- Check if valid if returning
          IF sdo_input.get_gtype() = 2
          OR boo_done = TRUE
          THEN
             RETURN sdo_input;
          END IF;
          int_looper := int_looper + 1;
          GOTO TOP_OF_IT;
       END linear_gap_filler;
    END dz_gap_fill;

  • Loader constraints (oracle/sql/converter/CharacterConverters)

    I'm trying to get OC4J standalone to work with instant client of JDBC in order to use OCI. I can run the java code stand-alone on the Oracle home I've installed the OC4J in, but when I try to run the application through OC4J I get the following error - indicating a setup problem?
    java.lang.LinkageError: Class oracle/sql/converter/CharacterConverters violates loader constraints
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].util.OC4JSecureClassLoader.defineClassEntry(OC4JSecureClassLoader.java:172)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].naming.ContextClassLoader.defineClass(ContextClassLoader.java:1179)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].naming.ContextClassLoader.defineClass(ContextClassLoader.java:1065)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].naming.ContextClassLoader.findClass(ContextClassLoader.java:404)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].naming.ContextClassLoader.loadLocalClassFirst(ContextClassLoader.java:158)
         at com.evermind[Oracle Application Server Containers for J2EE 10g (10.1.2.0.2)].naming.ContextClassLoader.loadClass(ContextClassLoader.java:137)
         at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
         at oracle.sql.CharacterSet1Byte.getInstance(CharacterSet1Byte.java:79)
         at oracle.sql.CharacterSetWithConverter.getInstance(CharacterSetWithConverter.java:91)
         at oracle.sql.CharacterSetFactoryThin.make(CharacterSetFactoryThin.java:104)
         at oracle.sql.CharacterSet.make(CharacterSet.java:430)
         at oracle.jdbc.driver.DBConversion.<init>(DBConversion.java:126)
         at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:356)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:348)
         at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:139)
         at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:79)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:563)
         at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:196)
         at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:146)
         at tsa.common.tsaDB.newConnection(tsaDB.java:30)
    I've searched but really found nothing indicating problems with this class. Is this an NLS problem?

    Well - I don't have to look for that setting - I know it's set to excatly that - because I did that ;)
    I cannot use the JDBC built into OC4J. First, it's using CLASSES12DMS - secondly I use XDB. Even if it was using OJDBC14 it most likely would not be "binary compatible" with the XDB from the 10g RDBMS. I've had this problem on the AS 10g of OC4J and I did try it on this one too. XDB crashes out with basically the same error -just different library.
    My issue is integration into OC4J. This application works outside OC4J (the method that fails work). By simply setting CLASSPATH to the OJDBC14 from the instant client, LD_LIBRARY_PATH to the *.so files from the same instant client, plus XDB from the 10g home, and XMLPARSEV2 - the connection succeeds and data is retreived etc.
    NOW - the exact error here I think I identified. OC4J loads ORAI18N - an older version (at least different from) compared to the one that comes with instant client. I put the instant client's ORAI18N in the "pre-path" load (that setting you refer to) and I'm now at a different loader constraint for sql/oracle/OPAQUE. Trying to identify which library, if any, that OC4J is providing which shouldn't be there.
    I've read the note that explains how to install a different version of JDBC with OC4J. Problem is, that instant client doesn't come with CLASSES12DMS - and secondly I've tried to replace the DMS version with a link to OJDBC14 and it staill failed.
    In a way this particular thread got resolved last night - but I still have the same basicly problem. Getting a different JDCB version using OCI to work from within OC4J 10.1.x.

  • Does the online function cater for a PDF file created in version 9 to be converted to version 6

    I am running Win98SE on one computer (A) and WindowsXP on another computer (B).
    On Computer A I am running Adobe Reader 6.06.
    On Computer B I am running Adobe Reader 9
    Is there a methodology (presumably outside of Adobe Reader) to convert a version 9 file to a version 6 file so that it can be opened in Computer A?
    Microsoft Office Word/Excel for example allows files created in current versions of Office to be opened in the current version and saved as an earlier version.
    Does one have to buy the full Adobe Acrobat package to get a similar function?

    No. Reader is just that a reader of pdf files. You would need Acrobat Standard or Pro to change a file to be read by an earlier version.

  • Converting VARCHAR2 to a DATE type-then need month spelled out

    I have a field that should be a DATE type, but is instead a VARCHAR2(8). The data in the VARCHAR2(8) field is displayed as what looks like a date -- EX: 09/18/09. I need to be able to convert the VARCHAR2(8) field so that it brings back the spelled out month plus the numeric day and year -- EX: September 18, 2009.
    I've been able to successfully convert a DATE type to the needed format (September 18, 2009) using the following syntax line, but now need to convert the VARCHAR2(8):
    to_char(jud_report_hear_off_v.incdate,'fmMonth dd, yyyy,') as INCDATE
    Your help is appreciated!!!

    So here is what worked.  I added this syntax line to my COMMAND in Crystal Reports:
           to_date(jud_report_hear_off_v.INCDATE, 'MM/DD/YYYY') as "INCDATE",
    Once that line was added into the COMMAND, the new format type was now a DATE and no longer a STRING (VARCHAR2).  I added INCDATE into my report and the date appeared as 09/19/2009, as it did before, but I could now select the INCDATE field via the Format Editor and see the option to select a desired Date and Time format.  I could then change the format to the choice of spelling out the month (EX:  September 19, 2009).
    Hope this helps others!  Whew!

  • Sql*net patch version 2.3.2.1.12 down load

    While I am migrating 7.3 database to 8i, system is asking for install sql net patch version 2.3.2.1.12. How can I get this patch. Is it possible to download.
    Thanks/Rgds
    Biju

    I know that I should first download and apply the AD related patches separetly. But, what is the best practice for downloading the rest of them? How does an experienced Applications DBA handle this kind of situation? I was trying to use the Patching Wizard on OAM, but the request errored out stating that "****No codeline specified". Where do I specify this when I download a list of patches? I just pasted a comma separated list of 249 patches into the PatchList field on Download Patches page.Please see these docs.
    'Analyze specific Patch' via Patchwizard is failing with java.lang.NullPointerException [ID 1066985.1]
    Patch Wizard Utility [ID 976188.1]
    Patch Wizard FAQ [ID 976688.1]
    Patch Wizard : Overview [ID 1077813.1]
    Thanks,
    Hussein

  • This project must be converted from version (macintosh 64) 12.0.x293. The original file will be unchanged

    Hi there,
    I'm making my first steps in After Effects.
    I bought Classroom in a book After Effects cc.
    The first step i have to take in lesson 1 is "Open and play the lesson01.mov sample movie to see what you will create in this lesson.
    When i dubbel click this file.. this message pops up in AE (This project must be converted from version (macintosh 64) 12.0.x293. The original file will be unchanged)
    The file will not play, and in the composition panel only a test image appears.
    Why is this and how can i fix it?
    I allready finished Lesson 1 but i still hope someone can explain me this message.
    I hope its not a stupid question but it is particularly difficult for me because English is not my native language and all the lesson material is in English.
    Kind regards
    Kay

    The warning simply means that the file was created in an older version of AE. The other issue is that you did not put your footage in the correct locations and it is missing. Use File --> Replace Footage to point to the proper storage locations.
    Mylenium

  • Abap sql convert to native sql fuction

    hi expert!
    exist a function can do follow things:
      convert selection-screen's select-options which user key in
         to oracle where condition expression
    or exist one function can convert abap sql to oracle sql
    thank you very much

    example:
      EXEC SQL.
            CONNECT TO :'DATA BASE NAME'
          ENDEXEC.
          IF sy-subrc EQ 0 .
             TRY.
                  EXEC SQL .
                    SELECT COUNT(*) FROM <TABLE NAME>
                    INTO :recount
                    WHERE code = :itab-<FIELD>
                  ENDEXEC .
                CATCH cx_sy_native_sql_error INTO exc_ref.
                  error_text = exc_ref->get_text( ).
                  MESSAGE error_text TYPE 'I'.
              ENDTRY.

  • Conversion from .pdf to .docx: I have converted a text in Slovenian in .pdf, but all the accents are missing in the converted .docx. version

    Conversion from .pdf to .docx:
    I have converted a text in Slovenian in .pdf, but all the accents are missing in the converted .docx. version.
    Does Adobe have a converter for texts with European-language accents, or shall I cancel my subscription?

    Subscription for what: ExportPDF or Acrobat?
    [topic moved to Acrobat.com Services forum]

  • APEX 3.0 requires PL/SQL Web Toolkit version 10.1.2.0.6 or greater

    Hi All,
    We have just upgraded our APEX 2.2.1 env (running in a 9.2.0.8 database) to APEX 3.1.1 and after that upgrade we realized about the requirement to have web toolkit version 10.1.2.0.6 installed prior to the installation of APEX 3.0.
    Based in this scenario, I have some questions:
    1. Can we install PL/SQL Web Toolkit version 10.1.2.0.6 on a 9.2.0.8 database? Our current PL/SQL Web Toolkit version is 9.0.4.0.6
    2. If so, can we do it now? after APEX 3.1.1 was installed?
    3. What are the problems we could have if we don't install web toolkit v. 10.1.2.0.6?
    Thanks in advance,
    Harvey

    Hi Harvey,
    1.) Yes you can
    2.) Yes you can install it after you have installed APEX 3.1.1 -> because it's independent of the APEX installation, it's just a pre-requirement for APEX to run.
    3.) I think I read one time in the forum that it's required for the region caching feature of APEX. But independent of that, if it's a documented pre-requirement I wouldn't wait until I hit a bug which would required 10.1.2.0.6
    Just my 2 cents
    Patrick

  • Convert pdf version 5 to pdf version 7

    Hi !
    I would like to know if it's possible to convert pdf file version 5 to pdf file version 7 ?
    The reason is we have infra with Globalscan version x and the final result of the PDF file is version 5. We need to convert to version 7. I would like to know if it's possible to do the conversion in batch mode.
    I know I can open pdf file and save to version 7 but we want to batch the process.
    Anyone have any clues about to do that ?
    Thanks in advance.
    Eric

    Well, if it's something you want to do without knowing the reason for it...
    There is a PreFlight (Advanced > PreFlight ...) profile that comes with Acrobat 8 Pro under the "Acrobat/PDF version compatibility" heading called "Compatible with Acrobat 7". The description reads "Makes the current PDF compatible with Acrobat 7 and saves it as a PDF 1.6 document."
    I just tried running that on a PDF 1.4 document and after running the fixups it then showed PDF 1.6 (Acrobat 7.x) when you right-click on the file, choose Properties and go to the PDF tab.
    Unless your client can provide valid reasoning for requiring your output to be PDF 1.6 I still feel this is a waste of time (since it's not a particularly fast operation - it scans the entire file checking each element to make sure it is 1.6 compliant before saving) but at least you have it as an option.

  • Not able to connect to MS SQL 2005 Evaluation version

    Hi,
    I have installed MS SQL 2005 Evaluation version(downloaded from microsoft site) on my win2k3 Enterprise Edition I am writing a java application that connects to MS SQL 2005.
    I have downloaded the MS SQL 2005 JDBC driver. And i unjarred the
    I have unjarred the sqljdbc.jar file and kept the com folder and my .java file in the same folder.
    When i am trying to connect, I am getting the following error:
    com.microsoft.sqlserver.jdbc.SQLServerException: Failed Logon:com.microsoft.sqlserver.jdbc.SQLServerException: TCP/IP connection failed to host:155.35.54.160 java.net.ConnectException: Connection refused:connect
    My code look like this:
    try {
    Class.forName ("com.microsoft.sqlserver.jdbc.SQLServerDriver");
    String fs = File.separator;
    String conn_str = "jdbc:sqlserver://155.35.54.160:1433;user=sa;password=SA;databaseName=asdb";
    conn = DriverManager.getConnection ( conn_str );
    catch (Exception e) {System.out.println(e); }
    Please reply.
    Thanks and Regards,
    Sudheer Gajula

    First aid check list for "connection refused":
    - Check host name in connect string.
    - Check port number in connect string.
    - Try numeric IP address of server host in connect string, in case name server is hosed.
    - Are there any firewalls between client and server blocking the port.
    - Check that the db server is running.
    - Check that the db server is listening to the port. On the server, try: "telnet localhost the-port-number". Or "netstat -an", there should be a listening entry for the port. You need to configure the database to accept TCP connections; read the documentation or google.
    - Try "telnet server-host-name the-port-number" from the client, to see if firewalls are blocking it.
    - If "telnet" fails: try telnet with the numeric ip address.
    - If "telnet" fails: does it fail immediately or after an obvious timeout? How long is the timeout?
    - Does the server respond to "ping serverhost" or "telnet serverhost" or "ssh serverhost"?

  • Looking for SQL*Net patch version 2.3.3.0.3

    Hello friends:
    In order to migrent a Oracle 7.3 database to a Oracle 8i DB I need a SQL*Net patch version 2.3.3.0.3. Would you please tell me where can I get it?
    Thank a lot!
    Zhang Weidong

    Hello friends:
    In order to migrent a Oracle 7.3 database to a Oracle 8i DB I need a SQL*Net patch version 2.3.3.0.3. Would you please tell me where can I get it?
    Thank a lot!
    Zhang Weidong

Maybe you are looking for

  • Break Up of Actual Costs in a report for list of orders

    Hi All, SAP standard reports displays only the total planned & total actual costs. Is there any standard report available which can display break up of planned & actual costs along with total costs, for list of orders (e.g: time, material and externa

  • Unexpected Safari quits

    Hello All!, These unexpected quits started happening again about a week ago. It usually happened much more frequently when using Safari v4; this is why I stick with v3.2.3. Now it happened again as I was trying to open a new window on top of the ones

  • How is it to use the program MacKeeper?

    Please tell me: is it good to use the program MacKeeper for your old iMac (intel)? Will it help and is it safe?

  • Possibility to use 3G with different providers

    Hi guys! Please answer on a simple question: Is it possible to use SIM cards from any providers not only AT&T in iPad which purchased in USA? I'm going to buy device in US and use it in Russia (3G here available). Thank you in advance!

  • Getting an Exception Unable to create Object

    I have the following methos I am getting the unable to create the file exception I believe the problem is when is trying to read the object I try the following record.setMessage(input.readObject().toString());           ///  record = (Message)input.r