SDO - how to create lines from PL/SQL

Hello,
I need to create a line objet in a table (TRAJECTORY) from selected points on another table (STATION).
STATION description is
station_id number,
trajectory_id number,
longitude float,
latitude float,
shape mdsys.sdo_geometry
TRAJECTORY description is
trajectory_id number,
shape mdsys.sdo_geometry
I would like to do something like
update trajectory set shape =
MDSYS.SDO_GEOMETRY
     2002,
     NULL,
     NULL,
     MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),
     MDSYS.SDO_ORDINATE_ARRAY
     (select longitude, latitude from station S where S.trajectory_id = trajectory_id)
It does not work.
I do not want to use an SQLLOAD because it is supposed to be updated with a trigger or a regular call to a store procedure.
Thanks in advance for your help,
Vincent ROBINE

Thanks a lot for your advice,
I have tried what you suggest, it seems to work fine for small line, but it does not work for big string.
For the test I wish to make, I have the following result:
update cycle_voyage set shape = MDSYS.SDO_GEOMETRY(2002,0,NULL,MDSYS.SDO_ELEM_INFO_ARRAY
(1,2,1),MDSYS.SDO_ORDINATE_ARRAY(16.641400,42.758900,16.768600,42.597300,16.869500,42.471200,16.9806
00,42.326300,17.097500,42.184100,17.211500,42.041200,17....
...00)) where platform_code = 'YTFL' and cv_number = 0
longueur : 13690
BEGIN fillSdoOrdinate('YTFL',0); END;
ERREUR ` la ligne 1 :
ORA-00939: too many arguments for function
ORA-06512: at "CODBA.FILLSDOORDINATE", line 29
ORA-06512: at line 1
My procedure is done this way :
create or replace procedure fillSdoOrdinate (p_platform_code varchar2, p_cv_number number) is
l_listePoints varchar2(20000);
l_nbPoints number;
cursor listeCoords is
select longitude, latitude from station
where platform_code = p_platform_code
and cv_number = p_cv_number;
begin
l_listePoints := 'update cycle_voyage set shape = MDSYS.SDO_GEOMETRY(2002,0,NULL,MDSYS.SDO_ELEM_INFO_ARRAY (1,2,1),MDSYS.SDO_ORDINATE_ARRAY(';
l_nbPoints := 0;
for curCoords in listeCoords loop
     if (l_nbPoints >0) then
     l_listePoints := l_listePoints||',';
     end if;
     l_nbPoints := l_nbPoints +1;
     l_listePoints := l_listePoints||trim(to_char(curCoords.longitude,'9999.999999'))||','||trim(to_char(curCoords.latitude,'9999.999999'));
end loop;
l_listePoints := l_listePoints||')) where platform_code = '''||p_platform_code||''' and cv_number = '||to_char(p_cv_number);
dbms_output.put_line(substr(l_listePoints,1,245)||'...');
dbms_output.put_line('...'||substr(l_listePoints,length(l_listePoints) - 50,51));
dbms_output.put_line('longueur : '||to_char(length(l_listePoints)));
execute immediate l_listePoints;
end;
show errors
If the 'EXECUTE IMMEDIATE' is limited to 2000 characters, it wont work because this is not the longest line and it is already 13690 characters long.
Any help would be welcome,
Vincent ROBINE

Similar Messages

  • How to Create PR from exeternal SQL Server through IDOC

    Dear all,
    I am in trouble while creating PR from exeternal SQL Server through IDOC . although I have created PR from TCODE we19 giving input as well as from function writen below
    My scnerio is from external system(Sql) want to send data to sap to create PR return PR No to SQl Server
    Not having idea how to do
    Basic Type for Idoc : PREQCR01
    Message Type       : PREQCR
    Function Module    : BAP_Idoc_Input1
    Thanxs in Advance

    if you have XI installed,
    than it would be easy,
    just use JDBC channel->XI->SAP IDOC.
    otherwise,
    you can export the table from the SQL to CSV file,
    and import it with LSMW with IDOC PREQCR01.

  • *Urgent*How to insert data from MS SQL to the table that create at the adobe form?

    Hi,
    I'm using Adobe life cycle designer 8 to do my interactive form. I would like to ask how to insert data from MS SQL to the table that i have created in my adobe interactive form?
    I really need the information ASAP as i need to hand in my project by next week... i really appreciate any one who reply this post.
    Thanks

    Tou need to do a couple of things
    1. On the Essbase server, set up an odbc system connection to your MySQL database
    2. In the load rule , go to the file menu and select open SQL data source and in the data source put in your SQL statement . A couple of hints. Where it says Select, don't put in the word select and where it say from don't put in from. The system adds them for you. The easiest way ti enter a SQL statement is to do it all in the select area So if your SQL would normanlly say select * from mytable just enter the code as * from mytable in the select area
    The click ol/retrieve and enter in your connection info. Itshould bring data back into the load rule. Save the load rule and use it

  • How to create database from .sql file

    how to create database from .sql file..?? i put the sintax query in a sql file.. and i want to call it in java code..
    ho to do it..??

    why do you want to do this from java?
    i just don't see the point.
    find your dba and have him/her run it for you

  • How to create a database in sql?

    My question is how to create a database in sql?

    entrant wrote:
    My question is how to create a database in sql?
    as Iam a beginner
    =================================================
    Learning how to look things up in the documentation is time well spent investing in your career.  To that end, you should drop everything else you are doing and do the following:
    Go to  docs.oracle.com.
    Locate the link for your Oracle product and version, and click on it.
    You are now at the entire documentation set for your selected Oracle product and version.
    BOOKMARK THAT LOCATION
    Spend a few minutes just getting familiar with what is available here. Take special note of the "books" and "search" tabs. Under the "books" tab (for 10.x) or the "Master Book List" link (for 11.x) you will find the complete documentation library.
    Spend a few minutes just getting familiar with what kind of documentation is available there by simply browsing the titles under the "Books" tab.
    Open the Reference Manual and spend a few minutes looking through the table of contents to get familiar with what kind of information is available there.
    Do the same with the SQL Reference Manual.
    Do the same with the Utilities manual.
    You don't have to read the above in depth.  They are reference manuals.  Just get familiar with what is there to be referenced. Ninety percent of the questions asked on this forum can be answered in less than 5 minutes by simply searching one of the above manuals.
    Then set yourself a plan to dig deeper.
    - *Read a chapter a day from the Concepts Manual*.
    - Take a look in your alert log.  One of the first things listed at startup is the initialization parms with non-default values. Read up on each one of them (listed in your alert log) in the Reference Manual.
    - Take a look at your listener.ora, tnsnames.ora, and sqlnet.ora files. Go to the Network Administrators manual and read up on everything you see in those files.
    - *When you have finished reading the Concepts Manual, do it again*.
    Give a man a fish and he eats for a day. Teach a man to fish and he eats for a lifetime.
    =================================

  • How to create a database in Sql server management studio

    how to create a database in Sql server management studio

    One method is to run the SQL statement below from a SSMS query window:
    CREATE DATABASE MyDatabase;
    You can also right-click on the Databases node in SSMS Object explorer and select New Database.
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • How to create data_block from procedure ?

    hi all
    can anyone to help me :
    how to create data_block from procedure ?
    i want to join 2 or 3 table and use order by
    then show some field in my form
    i can not use view because order by can not use in view
    please send sample code for this procedure
    thanks.

    1) >i can not use view because order by can not use in view
    SQL>create or replace view V_test as
      2  select * from (
      3  select 1 id from dual union
      4  select 2 id from dual union
      5  select 3 id from dual union
      6  select 4 id from dual union
      7  select 5 id from dual union
      8  select 6 id from dual ) t
      9  order by t.id
    10  /
    View created.
    SQL>select * from v_test;
            ID
             1
             2
             3
             4
             5
             6
    6 rows selected.2). >how to create data_block from procedure?
    You must create procedure and use ref cursor.

  • How to create line chart

    Hii Experts,
    How to create line chart?
    I want to  prepaire a line chart in a report. i have 1 table. In a table have 2 fields. chart is created in these 2 field refrence how It's possible?
    Thanx in Advance
    Regards
    Vshal

    I found it very easy to produce a line chart in a window container using FM GFW_PRES_SHOW.  In my case this produces a basic line graph with three lines across 15 time periods.
    See transaction GRAL for various chart types...they're relatively easy to produce...  I picked DEMO_GFW_PRES_SHOW report program from GRAL as my example for how to produce a simple line chart very quickly.

  • How to Start report from pl sql procedure

    I need to create a procedure which runs report and email report output to specified email adress.
    I don't know how to start report from pl/sql. Any help will be appreciated.

    I want to start oracle report from plsql procedure. Is there any OS system command I can use or any other method? My database is installed on windows 2000 machine.

  • How to replicate data from MS SQL Server  to Oracle

    Hi,
    Can someone please help me on how to replicate data from MS SQL Server to Oracle 8i database.

    Dear,
    I'm a student.
    I do simple replication on Oracle 8.0.5 successfully. (one master site and one snapshot site). I only use the SQL*Plus and Schema Manager to do.
    But when I do advance replication (multimaster replication) I meet many problem. So I don't get the result.
    Do you show me the technology to do that ?
    Thanks !

  • How to create report from report painter??

    Hi,
    how to create report from report painter?? from transaction code GRR1

    Select the library that you want report to create.  GRR1
    You select what to list in coulumns and what to lisr in rows. You could select characteristics or key figures.
    You can use variable both in defininig row and coulmn or in general selection.
    You can also use sets as variable or as constant. These sets can be your master data groups or sets in GS02.
    You can use formulas.

  • How to create CATALOG with MS SQL Server?

    Connection class has getCatalog(strCatalog) method. In order to use it, we must create CATALOG in Database?
    How to create CATALOG with MS SQL Server?
    Help me, please!!!

    You do not create these for any database, this is part of the Connection metadata.
    The Catalog is the third level of table-like database object qualification as in "Catalog.Schema.Table". For SQLServer the qualification scheme is "Database.Owner.Table" and I would be surprised if they reported anything for the current connections getCatalog() method call.
    What many people do is avoid table qualification altogether by setting the connection's context in a database proprietary manner and then keeping the SQL as clean as possible. For many ODBC and JDBC drivers this can be set in the configuration. For MS SQLServer you can also execute a "USE dbname" statement on the connection to avoid table qualification.

  • How To Create User through Pl SQL Block

    Want to create user from pl sql block using dynamic SQl. Used dbms_sql package . But when I run the block it does not recognises the parameter v7 which is a constant in dbms_sql package. Message displayed is Can not access parameter from package being restricted procedure.
    Is there any method to create user through PL SQl block

    hi ranjit,
    hope this will work
    declare
    uname varchar2(30):=&uname;
    pword varchar2(30):=&pword;
    begin
    execute immediate ('grant connect, resource to '| |uname| |' identified by '| |pword);
    end;
    regards

  • How to Create PDF from Illustrator CS3 by using applescript?

    Hi Guys,
    Do some one knows how to create PDF from Illustrator CS3 by using apple script. If know, please give me the scripting.
    HARI

    Have you tried File>Scripts>SaveDocsAsPDF? There should be a folder of sample scripts installed in your AICS3 folder and a folder of documentation which contains an Illustrator AppleScript Reference which has examples.

  • How to create "convert from PDF to Word?"

    How to create "convert from PDF to Word?"

    Good day,
    To use the ExportPDF service, simply visit http://exportpdf.acrobat.com and click 'Sign in' at the top right corner.  Enter your Adobe ID (email address) credentials to log into the service.  As ExportPDF is web-based, you simply utilize the tool through your web browser.  After you're logged in, you should see the ExportPDF interface, with a button saying 'Select PDF file..' to get the process started.
    Please let us know if you have any questions.
    Kind regards,
    David

Maybe you are looking for

  • Pro*C,Visual Studio 6 Error LNK2001 on _sqlcxt

    Hello, I have a problem in Visual C 6. After having precompiled a source with Pro*C,i want to compile with the IDE, but where is the error : error LNK2001: unresolved external symbol _sqlcxt Anyone knows how to solve this problem ? Thanks.

  • Hp Mini 1010NR Can Solid State Hard Drive be replaced with a normal drive?

    HP MINI 1010NR- Part Number FT315UA -8GB Solid State Drive Running Windows XP Home Edition The Hard Drive is listed in Device Manager as a ide\disksandisk PSSD 8GB  SSD 4.47 I have Windows XP fully updated and Microsoft Works 9.0 Fully updated on thi

  • Problem creating an A/P Invoice

    Hello, SAP experts: I have a customer with the following situation: He had created a down payment invoice for a vendor. Later, after the negotiations with the vendor ended, it turned out that the negotiated unit price for the purchased items was a sm

  • Errors in assets

    friends, after running depriciation run successfully, system is showing "  Errors occurred when processing assets. See the Error Log  " in asset balance report 87011963. when we go through the errors in assets all are showing the following error mess

  • Why does my Facebook app keep freezing?

    My Facebook app keeps freezing.  Right now it has been frozen for three days.  Any suggestions?