How to select only first few values in a Column

Hi, in one of the column of type SDO_GEOMETRY. In that column we have many values. Example : *(-6.33787700000002, 56.547309, -6.33786800000001, 56.547279, -6.33781400000001, 56.547249, -6.33776900000001)*
I wanted to know how can i select only first two or last two values from within the column.
Eg: i want only -6.33787700000002, 56.547309 to be displayed
Thanks

Hi,
Are the value specified here are multirow or single row data?
if it is multi row, Karthick solution should work. Else if it is a single row then try this
with T as
select '-6.33787700000002, 56.547309, -6.33786800000001, 56.547279, -6.33781400000001, 56.547249, -6.33776900000001' SDO_GEOMETRY from dual
-- end of sample data
select substr(SDO_GEOMETRY,1,instr(SDO_GEOMETRY,',',1,&cnt)-1) Output from T
PRAZY@11gR2> /
Enter value for cnt: 2
OUTPUT
-6.33787700000002, 56.547309
Elapsed: 00:00:00.05And remember, while posting questions it is good to specify your DB version with clear sample data and required output.
HTH,
Prazy

Similar Messages

  • How to select only last 4 characters in a column of type varchar2

    The data in column P_JACKS.LABEL is in the form of:
    294-001,
    B01-099,
    194A-098,....
    I'd like to select only the 3 characters following the '-' dash, and find the maximum of that set.
    This must be simple, I know, but so am I. Can someone please help me with this?
    Thanks!!

    I'm sure there is some slick regexp way to do it but this should work
    WITH t AS
      (SELECT '294-001' value FROM dual
      UNION ALL
      SELECT 'B01-099' FROM dual
      UNION ALL
      SELECT '194A-098' FROM dual
    SELECT greatest( (SUBSTR( value,LENGTH(value)-2,1)), (SUBSTR( value,LENGTH(value)-1,1)), (SUBSTR( value,LENGTH(value))) )
    FROM tmaybe I misunderstood do want to the max for the whole group as in 99
    or did you mean 3 rows with values
    1
    9
    9
    which is what I did
    Edited by: pollywog on Sep 9, 2010 6:45 PM
    Edited by: pollywog on Sep 9, 2010 6:47 PM

  • From list of IAP's in Aruba Central, how do I select only a few of them for license assignment?

    Q: I have hundreds of IAPs in the device management page of Aruba Central. How do I select  only a few of the them to assign license?
    A: Especially, when there is huge list of IAPs showing up in the device management page of Aruba Central, it becomes difficult and time consuming for an administrator to assign license for each IAP and then move on to the other.
    This problem was sensed by the Aruba Central development team before hand and put up a solution in place that would help a user to select multiple IAPs from the list and assign licenses to them at once.
    Lets understand on how to do the same:
    1. Once you login to Aruba Central, click on "All Groups" and move on to 'Device Management" under Maintenance.
    2. In the right-pane, you would be presented with the list of IAPs.
    3. Now , click on the "Search tool" and it pulls down the fields to enter the search text. 
    (NOTE: Make sure you have selected ALL in the above drop down. This helps central to search among all IAPs irrespective of group and license assignment.)
    4. Enter the Serial Number or MAC address of the IAP or Switch and hit "Search"
    5. Here is where the intelligence of Aruba Central comes to play.
    From  the search result select the IAPs and Central would remember your selected IAPs, even if you change the search string and initiate an other search.
    6. Once you finish searching all IAPs that you want to, you can click "Assign License" button in the lower left-corner and move on assigning the licenses to the selected IAPs

    This was a life saver! I even started to manually tick the box as well!

  • Select only first 10 chars from the field in a table while writlng a selec

    hi experts,
    In a table  one field contains a value of above 10 characters (ex 10 or 15 or 20 characters).But i want to select
    only first 10 characters from this field while writing a select statement.
    This logic should be included in select statement.
    please gime immediate solution.
    My question is understood.

    Hi,
    Try this one
    data : begin of itab occurs 0,
            maktx(10) type c,
    end of itab.
    " though the length of MAKTX is 40 you only get 10 chars
    select maktx from makt into table itab up to 10 rows.
    if sy-subrc is initial.
    endif.
    " Suppose the field name of table you want to select is MAKTX then declare
    " Your internal table in the above manner, it will automatically fit into it and will get 10 Chars only
    " Instead of burding the select query / DB interface use the above.
    Cheerz
    Ram

  • How to select the first record?

    Hi,
    Could anyone tell me how to select the first record of every
    group?
    ex, I want to find out every customer their first purcaseDate.
    CustomerID PurcaseDate Region
    A00000001 2001/01/01 AA
    A00000001 2001/02/02 AA
    A00000002 2001/03/01 AC
    A00000002 2001/05/07 AC
    A00000003 2001/03/05 DD
    result:
    A00000001 2001/01/01 AA
    A00000002 2001/03/01 AC
    A00000003 2001/03/05 DD
    Thanks

    Vincent,
    You could do it as Carl suggested, with a couple of
    corrections.  You would need to include the CustomNo column in
    the order by clause of your cursor.  You would also need to add
    a where clause to your update statement, otherwise everywhere
    Region in the table would be updated with the same value of the
    last CustomNo in the cursor, regardless of the CustomNo in the
    table.  See corrected code below:
    DECLARE
      CURSOR     cust
      IS
      SELECT     DISTINCT CustomNo, Region, Purchase_Date
      FROM       my_table
      ORDER BY   CustomNo, Purchase_Date, Region;
      c_customer VARCHAR2 (9) := '...';
      c_region   VARCHAR2 (2) := '..';
      cntr       NUMBER := 0;
    BEGIN
      FOR x IN cust
      LOOP
        IF x.CustomNo != c_customer
        THEN
          c_customer := x.CustomNo;
          c_region := x.Region;
        ELSE
          UPDATE my_table
          SET    Region = c_region
          WHERE  CustomNo = c_customer;
          cntr := cntr + 1;
          IF cntr = 25
          THEN
            COMMIT;
            cntr := 0;
          END IF;
        END IF;
      END LOOP;
      COMMIT;
    EXCEPTION
      WHEN OTHERS THEN 
        NULL;
    END;
    Another option is that you could just use one update statement,
    like this:
    UPDATE my_table a
    SET    Region =
           (SELECT DISTINCT Region
            FROM   my_table b
            WHERE  (CustomNo, Purchase_Date) IN
                   (SELECT   CustomNo, MIN (Purchase_Date)
                    FROM     my_table
                    GROUP BY CustomNo)
            AND    a.CustomNo = b.CustomNo)
    Barbara

  • Installed Itunes: New PC, Windows 7 x64, updated ipod software, click to eject ipod, PC goes to blue screen, dumps data, restarts; songs do not play correctly on ipod. IE: play a song - only first few seconds will play. Some songs play fully, some do not.

    Installed Itunes: New PC, Windows 7 x64, updated ipod software, click to eject ipod, PC goes to blue screen, dumps data, restarts; songs do not
    play correctly on ipod. IE: play a song - only first few seconds will play. Some songs play fully, some do not.

    Hi just wanted to let you know I solved most of my XP problems with my new IPOD. It won't recognise the IPOD or driver and froze and locked up and then the battery died. After hours of trying different things here is what I did. I completly closed computer down. Waited 15 minutes turned on and reloaded everything. I put the usb cable in but not hooked up to IPOD. I turned off Mcaffee (all of it). After my computer came on. I then went and closed everything I didn't need in the bottom toolbar. (taskbar). I then reloaded the software and waited. Took forever to reload and I don't know why but whatever it worked but I DID NOT HOOK UP THE IPOD LIKE IT SAID! I instead shut down the computer after loading the software and waited 5 minutes and turned it back on. I again waited and shut of mcaffee. It loaded everything fine this time and said new hard ware and drivers detected. I plugged my IPOD in and YES I WAS UP AND RUNNING (THIS IS AFTER 6 HOURS OF PLAYING WITH OTHER THINGS!) I am able to load and play, burn, watch movies, see pictures and everything your suppose too! The only thing I see different than the instructions is I left my usb cable plugged in and when it said to eject the disk I didn't. I also didn't plug in the IPOD (5th Gen) and then I shut down waited and then restarted the computer. I hope this helps others because I know the feeling of wanting to return something you paid dearly for and worked hard at saving money to buy one and it doesn't work. My only thing I dislike about apple is they didn't supply a ac adapter for the IPOD and the instructions say to plug it up when trying to charge battery. DUHHHHHH, ya can't do that if ya don't have one and stores are closed and won' open until Monday! But at least I am up and running. I just hate having to plug up IPOD to computer daily to charge the battery which only last a half a day1

  • Anyone know how to select only even or odd numbered files in lightroom?

    Anyone know how to select only even or odd numbered files in lightroom? I need to reduce the quantity of images in my timelapse sequence and this would help me greatly since there are 8250 images and doing this maually would be tediuos and make me want to kill myself.... : )

    Do this.
    If they are jpegs, use .jpg instead of CR2
    Be sure to save this as a preset, as you WILL need it again. Mine is named "select even CR2", that is why it says that in the upper right.

  • Windows Explorer - How to select the first item once we open the explorer?

    Hi,
    In Windows Explorer - How to select the first item once we open the explorer using keyboard shortcut. I typically use downward arrow, it goes to the 2nd item in the list, then I again have to use upward arrow to go up.
    Is there a shortcut to select the first item in the list using keyboard? This is not specific to Windows 7, it has been the behavior even in previous Windows OS versions.
    Thanks,
    Mallik

    Opening a Microsoft Ticket is probably your best option. Unfortunately the change will not happen immediately and it will require multiple users to send in a ticket. I hope this ends up being resolved though.
    Good luck Mallik
    Also, don't forget to mark the post as answered so that it does not show up as unanswered to help others who search the forums.
    Agreed, MS wont change it easily. :)
    Arnav Sharma | http://arnavsharma.net/ Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading
    the thread.

  • New 80gig ipod.. Plays only first few seconds on most songs?

    New 80gig ipod.. Plays only first few seconds on most songs?
    I am runnign disk checks resets etc..
    if cannot get working taking back to futureshop

    I just posted a more detailed response to this on a similar post. The only way I have found is to convert to MP3, which *****. Look for the other post.

  • Query only non numeric values in a column

    How to query only non numeric values in a cloumn.
    For example:
    Table1 has a column1(col1)
    Values:
    Row Value
    1 27376
    2 47D99
    3 83039
    4 DKFI*
    5 3J6
    Query should retrieve only rows(2,4,5).
    Thanks! for help
    Murali

    Version 2(PL/SQL) above is not clear enough, It can be tuned to the following:
    -- Create a function
    Create or replace function IsVARCHAR(pCol VARCHAR2) return VARCHAR2
    AS
    vNumber NUMBER := 0;
    begin
      vNumber := to_number(pCol);
      RETURN NULL;
    Exception
      When Others Then
        RETURN pCol;
    End;
    -- To See VARCHAR values (alpha-numeric) only!
    SELECT col1 FROM tab1
    WHERE IsVARCHAR(col1) IS NOT NULL;
    -- To See NUMBER values only!
    SELECT col1 FROM tab1
    WHERE IsVARCHAR(col1) IS NULL;Versatility here with PL/SQL, but I personally like SQL versions.
    Thx,
    SriDHAR

  • How can I reference the last value in a column?

    How can I reference the last value in a column? For example, today I want the value of A1 to appear in another cell. Tomorrow, I will add a row and want to reference A2, next day A3, and so forth.

    Now I got it:
    =OFFSET(A1,COUNT(A)-1,0)

  • How to Select More then 1000 values in Multi-Select prompt!!!

    Hello Users,
    I have Scenario where i have to pass all the values from prompt to report and the values in the prompt are coming from session variable, so whatever value access user has the report will run with that only...
    Now the question is that Multi-Select Prompt is not able to take more then certain values, so is there any way that we can increase the limit for selected values??
    in-short how to increase the limit for selected values in multi-select prompt??
    Thanks In Advance!!!

    Hey David,
    The Scenario is like, we have data level security on "Unit" attribute. now based on the user selection when user logs in he should able to see the report only for those units which he/she has access.
    in total we have 1800 units available, now for 5-10 units access is fine, but the question will arise when user will not have only some units access from 1800 units.
    because report will not take those values from the multi-select prompt reason is that multi-select prompt is not able to take more then certain values in selected side.
    now in multi-select until-unless u have data coming in selected side those values will not pass. so i have kept the sql in default for that prompt.
    so when user logs in he will able to see those values in selected side for the multi-select prompt, but when values increase from some level it's going automatically in un-selected side.
    i want everything on selected side of multi-select prompt.
    Let me know if you need any further details.

  • How to make a select list to return value to numeric column?

    I do have a select list with static values (STATIC:01;0,02;1,03;2,04;3,05;4,06;5,07;6,08;7,09;8,10;9). The problem is that I am returning a value to a numeric column. Therefore I have set 'Post Calculation Computation' as "to_number(:P73_MRGRATING, 9);" however I am getting ORA-01722: invalid number. How, (or when and where) to properly convert a character from a select list representing a numeric value into column of NUMBER data type?
    Thank you for your time.
    DanieD

    Sergio,
    It is because I am not able convert a value in a page item (:P73_ID) to number. On a page before, I have assigned a value to an application item (APPL_ID). On page 73, I want to assign the value in APPL_ID to the page item P73_ID . The value assigned to APP_ID is numeric. On a page 73 I also have a computation in Page processing section. It is an 'After Submit' processing of a static assignment of application item APPL_ID to page item P73_ID. Unfortunately it does not work. (ORA-01722: invalid number). I have tested this also with a 'Post Calculation Computation' on page item P73_ID (to_number(:P73_ID, 9999999999);) and I am still getting ORA... error. Only way I can make it work is to create a page item P73_ID as a text field, then when I run page 73 and enter a value into P73_ID manually - then it works and I can save the values from the form into database...
    The strange thing is that I am using application item APPL_ID on a couple of pages, in where clauses and it always works, even when I am comparing APPL_ID against a numeric value like select * from a_table where some_number = :APPL_ID, this works. But when I would like to create an entry form and assign application item APPL_ID to the page item P73_ID that is referencing a numeric table column – then I am getting ORA-01722…
    Is there any application (sample application) that is doing this and it works so I can check it and learn how to create this process appropriately?
    Thank you for your time.
    DanielD

  • JDBC: How  to select only those records which contains col1 is NULL

    Hi All,
    In JDBC SELECT scenario.
    I wants to select only those records which contains col1 is NULL.
    I am trying as follows:
    <key>
    <col1 isNull="TRUE" />
    </key>
    but in moni/monitoring i am getting Following Error
    006-12-01 19:35:20 Error Unable to execute statement for table or stored procedure. 'BG_SALARY_SEND_SAP_D' (Structure 'SELECT') due to java.sql.SQLException: FATAL ERROR document format: structure 'SELECT', key element 'key' contains no values
    2006-12-01 19:35:20 Error Exception caught by adapter framework: Error processing request in sax parser: Error when executing statement for table/stored proc. 'BG_SALARY_SEND_SAP_D' (structure 'SELECT'): java.sql.SQLException: FATAL ERROR document format: structure 'SELECT', key element 'key' contains no values
    Please suggest how to do select rows with col1 is null.
    Regards

    Rohan,
    isNull= true is used to make the KEY element not mandatory.
    In your case, if the select query is
    select emp from emptest where empno is null
    , then the datatype will be,
    <root>
    <StatementName>
    <dbTableName action=”SELECT”>
      <table>emptest</table>
    <access>
    <emp></emp>
    </access>
    <key1>
    <b><empno hasQuot="NO">is null</empno></b>
    </key1>
    </dbTableName> 
    </StatementName>
    </root>
    I dont have a DB access to try this, but I think this should work.
    If this doesnt work, then you would need to use SQL_QUERY,
    <root>
    <StatementName>
    <anyName action=” SQL_QUERY”>
    <access>select emp from emptest where empno is null</access>
    </anyName > 
    </StatementName>
    </root>
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Regards,
    Bhavesh

  • I got a new iPhone 5 and my itunes music will not sync properly. it will show up on the phone but it is light gray wording and they are not selected only a few songs work. The grayed out music just takes up space. Someone please help.

    My itunes music is grayed out and unplayable on my new iphone 5. only a few songs work and the rest just take up space. They will play correctly in my itunes on the computer but not the phone. Please help.

    I am so relieved to hear that I am not the only one experiencing this! However, I am sorry to hear you are going through this as well. Lucky for me I am upgrading to a 5s which will be sent to me on Wednesday. I did stumble upon an article with tips on how to downgrade back to iOS 7, but I am EXTREMELY apprehensive about doing that myself. Here's the article link if you want to give it a go:
    http://osxdaily.com/2014/09/21/downgrade-ios-8-back-to-ios-7-1-2/

Maybe you are looking for