I HAVE A VARCHAR2 COLUMN.

Hello


I HAVE A VARCHAR2 COLUMN. IN THIS ARTICLE I STROED ALL CHARACTER DATA. A FILE EXCTION NAME,
TEST. DOC, TEST2. DOC, TEST3. DOC AND TEXT_MAIN. DOC NOW, I WANT TO EXTRACT THE STRING UP. A CHARACTER THAT WORKS, I WANT TO USE TO GET THE MAXIMUM VALUE OF. CHERECTER, MEANS I DON'T WANT EXTENSION I WANT ONLY THE FILE NAME.

Thank you

One of the possibilities:

SQL > SELECT SUBSTR('TEST.DOC',1,INSTR('TEST.DOC','.',1)-1) FROM DUAL;

SUBS
----
TEST

Tags: Database

Similar Questions

  • Changing a varchar2 column (11) to varchar2 (15)

    Hello

    I have a table of 600GO containing nearly 200 columns. This picture is obviously not truncated, it is a table partitioned and sous-partitionnée. I have a varchar2 column I need to increase the length. This table is in a production database and so I don't have TO run any risk with him even if I have to find a way to increase the size of the relevant column. Let's say that the table name is XLARGE_TABLE and the column I need to edit is called FIRST_COLUMN. I would like to know the safety and execution of the execution of the following simple ALTER statement:

    ALTER TABLE XLARGE_TABLE CHANGE FIRST_COLUMN varchar2 (15).

    NOTE: FIRST_COLUMN is filled throughout with millions of rows table.

    Thank you very much for your attention to help me in this regard.
    T. San.

    Hello

    Alter A VARCHAR2 (10) to VARCHAR2 (10) WILL take very very little time (micro seconds), it will stop any transaction instruction dml on tables.
    ---------------------------------------------------------------------------------------------------------
    SQL > desc emp;
    Name Null? Type
    ----------------------------------------- -------- ----------------------------

    NAME VARCHAR2 (10)

    SQL > alter table emp change (name varchar2 (15));

    Modified table.

    SQL > desc emp;
    Name Null? Type
    ----------------------------------------- -------- ----------------------------

    NAME VARCHAR2 (15)

    Published by: Rajesh.Rathod on January 25, 2009 13:27

  • Need to convert the Varchar2 column number for the extraction of data based on the range of values.

    Hello

    I have a ZIP column which is the Varchar2 data type, it has values such as 2345, 09485, 10900, 07110, 06534.

    I have to go look up records from the range of values for the ZIP column as between 00000 and 07500.

    Could you give a logic.

    Thank you.

    Hello

    I think you can use the following code:

    SELECT T.*

    OF t

    WHERE the to_number (ZIP) between TO_NUMBER('0000') and TO_NUMBER('07500')

    ;

    CGomes

  • VARCHAR2 columns stored as anything other than letters

    Hey guys out there.
    I use Oracle Forms, but I need to know all the columns in a table (columns VARCHAR2) that have data that was not saved as uppercase. That is why I posted my question here and not in the forms. Any help would be great. The shape, that I'm looking tables and many albums and a lot of VARCHAR2 columns :-)

    I looked at the description of all_tab_columns but I doubt that could give me the information I'm looking for.

    Thank you

    Published by: Roxyrollers on January 15, 2013 15:07

    There is no data dictionary attribute that indicates if the column given tiny inside. So the only option would be to check each column.

    Of course, you could write a bit of dynamic SQL to do this

    DECLARE
      l_sql_stmt varchar2(32000);
      l_cnt pls_integer;
    BEGIN
      FOR x IN (SELECT * FROM all_tab_columns WHERE data_type = 'VARCHAR2')
      LOOP
        l_sql_stmt := 'SELECT COUNT(*) FROM ' || x.owner || '.' || x.table_name || ' WHERE ' || x.column_name || ' != upper(' || x.column_name || ')';
        EXECUTE IMMEDIATE l_sql_stmt INTO l_cnt;
        IF( l_cnt > 0 )
        THEN
          <>
        END IF;
      END LOOP;
    END;
    

    This is going to be rather ineffective, however, particularly if the tables are large.

    Justin

  • Get only the Varchar2 column channels

    Hello
    How can I extract only strings form varchar2 column type?
    I have data like below.

    25 - Abc xy
    233 - xyz jj
    x23A
    9 - dd
    5 - AAA (pp)

    I need the outputs (-also be deleted)

    ABC xy
    XYZ jj
    xA
    DD
    AAA (pp)


    Thank you
    Sujnan

    Maybe...

    API> WITH t AS (SELECT '25-Abc xy' AS col FROM DUAL
      2          UNION
      3          SELECT '233-xyz jj' FROM DUAL
      4          UNION
      5          SELECT 'x23A'  FROM DUAL
      6          UNION
      7          SELECT '9-dd'  FROM DUAL
      8          UNION
      9          SELECT '5-aaa(pp)'  FROM DUAL)
     10    SELECT TRANSLATE(col, '1234567890-', ' ') AS RES
     11    FROM t;
    
    RES
    ----------
    xyz jj
    Abc xy
    aaa(pp)
    dd
    xA
    
    Transcurrido: 00:00:00.93
    
  • Only download the form type VARCHAR2 column numbers

    Hello
    How can I extract only numbers form varchar2 column type?
    I have data like below.

    25 - Abc
    233 - xyz
    x23A
    9 - dd

    I need following output
    25
    233
    23
    9

    Thank you
    Sujnan

    Hi try this

    SQL> with t as(select '25-Abc' test_string from dual union all
      2  select '233-xyz' from dual union all
      3  select 'x23A' from dual union all
      4  select '9-dd' from dual)
      5  select regexp_substr(test_string,'[[:digit:]]+') from t;
    
    REGEXP_
    -------
    25
    233
    23
    9
    
  • Need for clarification to varchar2 column

    I get xml that will be inserted in the local table messages
    It is, I don't really know the size of the incoming xml message data.
    Design of the structure of the table is now difficult.
    If I design the column in the table for column varchar2 with VARCHAR2 (4000) and if the message contains the value
    as 'SAM', 'GEORGE' (no more than 10 characters) then it does not seem good for the VARCHAR2 COLUMN (4000)
    Oracle does not create the table with VARCHAR2 (without specifying the size)

    Any suggestions?

    S

    There's no real difference if you use varchar2 (4000) or varchar2 (100). Apart from the obvious that you can store up to 4000 bytes, against only 100/characters multibyte.

    However, there are a few minor side effects. Few of them and a comparison of the performance is described here: http://arjudba.blogspot.de/2009/08/does-oversize-of-datatype-varchar2.html

    (1) the varchar2 column indexing 4000 could be a problem (the ora-01450 exceeded max key length).

    (2) the size of the table could be actually smaller for tables with many sparesly populated varchar2 4000 columns. I can't find the source for that at the moment, but it had to do with the way oracle reserves future space required for the column.

    (3) migration of rank is more likely to happen if the great texts are added (= update) later.

    (4) If you define a variable with % rowtype in the table, it will use more expensive space PGA

    (5) some tools like TOAD could get questions or need of more resources to operate on 4 k columns.

  • What does that mean?  ORA-32039: WITH recursive clause must have list of column aliases

    What does that mean?  If I have alias each column in the clause, I get the same error.  I noticed that if I replace this point of view abw_v_exist_mbr_alt_hierarchy , with a statement select hard-coded query works.

    ORA-32039: WITH recursive clause must have list of column aliases

    [code]

    with bridge as)

    SELECT

    AVS.pontis_bridge_id,

    AVS.super_struct_name structure_name,

    ALV.name vehicle_name,

    AVS.inv_rf inv_rating_factor,

    AVS.opr_rf opr_rating_factor,

    AVS.post_rf legal_rating_factor,

    AVS.safe_rf permit_rating_factor,

    sys_type_display. Display inv_rating_method,

    AVS.up_to_date_ind,

    AE.event_descr,

    AE.event_timestamp,

    AP.username,

    AVS.event_id,

    SYS_TYPE_IMPACT. Display sys_type_impact,

    SYS_TYPE_LANE. Display sys_type_lane

    Of

    (SELECT

    AVEMAH.pontis_bridge_id,

    AVEMAH.super_struct_name,

    ARRS.vehicle_id,

    min (ARRS.inv_rf) inv_rf,

    min (ARRS.opr_rf) opr_rf,

    min (ARRS.post_rf) post_rf,

    min (ARRS.safe_rf) safe_rf,

    ARRS.design_method_type,

    ASMAE.event_id,

    ASMAE.up_to_date_ind,

    ARRS.impact_loading_type,

    ARRS.lane_loading_type

    Abw_v_exist_mbr_alt_hierarchy AVEMAH, abw_spng_mbr_alt_events ASMAE, abw_rating_results_summary ARRS

    WHERE

    AVEMAH.bridge_id = ASMAE.bridge_id

    and ASMAE.bridge_id = ARRS.bridge_id

    and AVEMAH.struct_def_id = ASMAE.struct_def_id

    and ASMAE.struct_def_id = ARRS.struct_def_id

    and AVEMAH.super_struct_mbr_id = ASMAE.super_struct_mbr_id

    and ASMAE.super_struct_mbr_id = ARRS.super_struct_mbr_id

    and AVEMAH.super_struct_spng_mbr_alt_id = ASMAE.super_struct_spng_mbr_alt_id

    and ASMAE.super_struct_spng_mbr_alt_id = ARRS.super_struct_spng_mbr_alt_id

    and ASMAE.event_id = ARRS.event_id

    and ASMAE.results_use_type = 37601

    GROUP OF AVEMAH.pontis_bridge_id, AVEMAH.super_struct_name, ARRS.vehicle_id, ARRS.design_method_type, ASMAE.event_id, ASMAE.up_to_date_ind, ARRS.impact_loading_type, ARRS.lane_loading_type

    ) AVS.

    abw_lib_vehicle BIANCO,

    abw_event AE,

    abw_person AP,

    abw_sys_type sys_type_display,

    abw_sys_type sys_type_impact,

    abw_sys_type sys_type_lane

    WHERE AVS.event_id = AE.event_id

    AND AE.entered_by = AP.person_id

    AND AVS.vehicle_id = ALV.vehicle_id

    AND AVS.impact_loading_type = SYS_TYPE_IMPACT.sys_type

    AND AVS.lane_loading_type = SYS_TYPE_LANE.sys_type

    AND AVS.design_method_type = sys_type_display.sys_type)

    Select

    t.pontis_bridge_id BRIDGE_NAME,

    t.event_timestamp LOAD_RATING_DATE,

    MAX (CASE WHEN t.vehicle_name = 'HL-93 (US)' THEN round (t.inv_rating_factor, 2) ELSE NULL END) LOAD_RATING_HL93_INV_FACTOR,.

    MAX (CASE WHEN t.vehicle_name = 'HL-93 (US)' THEN round (t.opr_rating_factor, 2) ELSE NULL END) LOAD_RATING_HL93_OP_FACTOR,.

    Max(case when t.vehicle_name = 'H 20-44' Then trunc (t.inv_rating_factor * 36) of OTHER END NULL) H_INV_RATING_TONS,.

    Max(case when t.vehicle_name = 'H 20-44' Then trunc (t.opr_rating_factor * 36) of OTHER END NULL) H_OP_RATING_TONS,.

    Max(case when t.vehicle_name = 'HS 20-44' Then trunc (t.inv_rating_factor * 36) of OTHER END NULL) HS_INV_RATING_TONS,.

    Max(case when t.vehicle_name = 'HS 20-44' Then trunc (t.opr_rating_factor * 36) of OTHER END NULL) HS_OP_RATING_TONS,.

    Max(case when t.inv_rating_method='LRFR' Then trunc (t.inv_rating_factor * 36) of OTHER END NULL) LRFR_INV_RATING,.

    Max(case when t.opr_rating_method='LRFR' Then trunc (t.opr_rating_factor * 36) of OTHER END NULL) LRFR_OP_RATING,.

    Max(case when t.vehicle_name = 'SU4' Then Round (t.legal_rating_factor, 2) of OTHER END NULL) LOAD_RATING_SU4_LEGAL_FACTOR,.

    Max(case when t.vehicle_name = 'Type 3S2' Then Round (t.legal_rating_factor, 2) of OTHER END NULL) LOAD_RATING_3S2_LEGAL_FACTOR,.

    Max(case when t.vehicle_name = 'Type 7 divisible Load Vehicle' Then Round (t.permit_rating_factor, 2) of OTHER END NULL) LOAD_RATING_TYP7_PERM_FACTOR,.

    Max(case when t.vehicle_name = 'Type 6A divisible Load Vehicle' Then Round (t.permit_rating_factor, 2) of OTHER END NULL) LOAD_RATING_TYP6A_PERM_FACTOR,.

    MAX (CASE WHEN t.vehicle_name = 'HL-93 (US)' THEN round (t.permit_rating_factor, 2) ELSE NULL END) LOAD_RATING_HL93_PERM_FACTOR,.

    (CASE WHEN t.inv_rating_method = 1 THEN 'LFD'

    WHEN t.inv_rating_method = 'ASD' THEN 2

    WHEN t.inv_rating_method = 'LRFD' THEN 3

    WHEN t.inv_rating_method = 'LRFR' THEN 8 ELSE NULL END) LOADRATE_METHOD_ID,.

    t.UserName LOAD_RATING_SUBMITTED_BY

    Bridge t,.

    (select q.pontis_bridge_id, max (q.event_timestamp) max_et

    Bridge q

    where q.impact_loading = 'as requested.

    and q.lane_loading = 'as requested.

    Q.pontis_bridge_id group) max_event_timestamp

    where t.impact_loading = 'as requested.

    and t.lane_loading = 'as requested.

    and t.pontis_bridge_id = max_event_timestamp.pontis_bridge_id

    and t.event_timestamp = max_event_timestamp.max_et

    and t.username = 'PCAMPISI. '

    GROUP BY

    t.pontis_bridge_id,

    t.event_timestamp,

    t.UserName,

    t.inv_rating_method;

    [/ code]

    You must use the database version 11.2, right?

    ORA-32039: WITH recursive clause must have list of column aliases

    Cause: A query clause called WITH itself (recursive) but do not have a list of aliases for column specified to him.

    Action: Add a list of column alias for the WITH clause query name.

    See:

    SELECT

    Example (you add the list of columns in the "BOLD" part / underlined below):

    WITH

    reports_to_101 (emp_last, mgr_id, eid, reportLevel) AS

    (

    SELECT employe_id, last_name, manager_id reportLevel 0

    Employees

    WHERE employee_id = 101

    UNION ALL

    SELECT e.employee_id, select, e.manager_id, reportLevel + 1

    Reports_to_101 r, e employees

    WHERE r.eid = e.manager_id

    )

    SELECT mgr_id, reportLevel, emp_last and eid

    OF reports_to_101

    ORDER BY reportLevel, eid;

  • asscending Varchar2 column order, including the number of

    Hello everyone.

    I have a RANK_NO column. It contains values of integers from 1 to 12.
    I want to organize the integers in the order of asscending with ORDER OF RANK_NO. It gives the following result.

    1
    10
    11
    12
    2
    3
    4
    5
    6
    7
    8
    9
    Instead, I want them to be in order
    1
    2
    3
    4
    ...
    12
    There is no solution for this?
    Best regards.

    Ok

    Maybe you want to do something like that?

    with test_tab as
    (select '1'  rank_no from dual
    union all select '11' from dual
    union all select '12' from dual
    union all select '2' from dual
    union all select '3' from dual
    union all select 'A' from dual
    union all select 'B' from dual
    )  -- End of Test Data
    select * from test_tab
         order by
            to_number (regexp_substr( rank_no, '[0-9]+')),
            regexp_substr( upper(rank_no), '[A-Z]+')
    /
    
    RA
    --
    1
    2
    3
    11
    12
    A
    B
    
    7 rows selected.
    
    SQL> 
    

    Arun-

  • Is it possible to have a fixed column width and a URL link?

    I'm trying what a popup link on a column in a SQL report, but also have the report column a certain width. Can I have or not however at the same time.

    What I did was created a SQL report, published a column and he gave a URL redirect (page in application) as usual.

    Fixed column width, I used:
    <div style="width:250px; height:54px; overflow:hidden" title="#Comments#">#Comments#</div>
    The formatting of column / Expression HTML

    And for the URL of the popup, I used:
    onclick="window.open(this.href,'_blank','resizable=0,scrollbars=0,width=650,height=300,menubar=0,location=0');return false;" title="Comments"
    On the column link / link attributes

    Hello

    It is possible that there is an error in your code - shows your snapshot & 523. -the & and the. should not be there. If you have changed to that of & APP_ID., then you don't need the & or the. but, normally, you should leave as & APP_ID. as the value for this will change when you move from dev to test for prod and Apex will automatically replace this string with the number of correct application.

    Andy

  • I have the blob column in a table. I want to break up the value of the column in characters varchar2 (4000) (block).

    Example of

    create table test (id primary number, data key blob);

    I want to display like

    Select code, data of the test;

    ID data

    1 character 4000

    1 character 4000

    1 character 4000

    .

    .

    and soon.

    Please help me on this

    BLOB stores binary data. What is the point of converted them to a varchar2? If the LOB will store the character data, then the appropriate data type would be CLOB. Said that, assuming that you will use CLOB here is the answer to your question.

    drop table temp purge;

    create table temp

    (

    integer ID

    clob c_lob

    );

    declare

    CLOB var;

    Start

    DBMS_LOB.CREATETEMPORARY (var, true);

    because me in 1.32 loop

    DBMS_LOB. WriteAppend (var, 1000, rpad ('x', 1000, 'x'));

    end loop;

    insert into temp (id, c_lob) values (1, var);

    insert into temp (id, c_lob) values (2, var);

    commit;

    end;

    /

    Select id

    rno

    , length (dbms_lob.substr (c_lob, 4000, offset)) c_lob_var_len

    , dbms_lob.substr (c_lob, 4000, offset) c_lob_var

    de)

    Select id

    , ((level-1) * 4000) + 1 offset

    c_lob

    level NWR

    temp

    connect

    by level<=>

    and prior id = id

    and dbms_random.value (prior) is not null

    );

  • Is it possible to have definitions of columns in a table to create

    I was wondering if it is possible to have calculated columns, such as those below in the statement CREATE TABLE in Oracle. And if so, how do write you?

    * CREATE TABLE [Sales]. [SalesOrderHeader] (*
    * [SalesOrderID] [int] IDENTITY (1,1) NOT for REPLICATION NOT NULL, *.
    * [SalesOrderNumber] AS (isnull (do SO'+ CONVERT ([nvarchar] (23) [SalesOrderID], 0), no * ERROR *')), *.
    * [Subtotal] [money] NOT NULL, *.
    * [TaxAmt] [money] NOT NULL, *.
    * [Transport] [money] NOT NULL, *.
    * [TotalDue] AS (isnull (([SubTotal]+[TaxAmt]) + [Freight], (0))), *.
    *)*

    I would like to re - write the definition of table CREATE TABLE DTPartInv with partinv_flag AS a computed column when the value is X,
    If partinv_instock < partinv_reorder and O
    If partinv_instock > = partinv_reorder:

    CREATE TABLE DTPartInv
    (partinv_partnbr VARCHAR2 (10) NOT NULL,)
    partinv_prodname VARCHAR2 (25).
    partinv_desc VARCHAR2 (25).
    partinv_manufact VARCHAR2 (25).
    partinv_instock      INTEGER NOT NULL,
    partinv_category VARCHAR2 (20).
    partinv_purchdate DATE,
    partinv_loc VARCHAR2 (15).
    partinv_price NUMBER (6.2),
    partinv_vendor VARCHAR2 (20).
    partinv_reorder      INTEGER NOT NULL,
    partinv_serial VARCHAR2 (20).
    partinv_flag      VARCHAR2 (1).
    CONSTRAINT DTPartInv_partinv_partnbr_pk
    PRIMARY KEY (partinv_partnbr)
    );

    >
    I was wondering if it is possible to have calculated columns, such as those below in the statement CREATE TABLE in Oracle. And if so, how do write you?
    >

    You did not mention your Oracle database version. Depending on your version, you can do. If you're on 11 GR 1 material or above, you can follow these steps:

    CREATE TABLE DTPartInv
         ( partinv_partnbr VARCHAR2(10) NOT NULL,
         partinv_prodname VARCHAR2(25),
         partinv_desc VARCHAR2(25),
         partinv_manufact VARCHAR2(25),
         partinv_instock INTEGER NOT NULL,
         partinv_category VARCHAR2(20),
         partinv_purchdate DATE,
         partinv_loc VARCHAR2(15),
        partinv_price NUMBER(6,2),
        partinv_vendor VARCHAR2(20),
        partinv_reorder INTEGER NOT NULL,
        partinv_serial VARCHAR2(20),
        partinv_flag as (case when partinv_instock < partinv_reorder then 'X' else 'O' end),
        CONSTRAINT DTPartInv_partinv_partnbr_pk
        PRIMARY KEY (partinv_partnbr)
      ) ;
    
    Table created.
    

    -Test it now

    -Box partinv_instock when <> _
    SQL > insert into DTPartInv (partinv_partnbr, partinv_instock, partinv_reorder) values ('Test', 10, 20);

    1 line of creation.

    -Box when partinv_instock = partinv_reorder_
    SQL > insert into DTPartInv (partinv_partnbr, partinv_instock, partinv_reorder) values ('Test2', 10, 10);

    1 line of creation.

    -Box when partinv_instock > partinv_reorder_

    SQL > insert into DTPartInv (partinv_partnbr, partinv_instock, partinv_reorder) values ('Test3', 20, 10);

    1 line of creation.

    SQL> select partinv_partnbr, partinv_flag from DTPartInv;
    
    PARTINV_PA P
    ---------- -
    Test       X
    Test2      O
    Test3      O
    
    3 rows selected.
    

    Happy?

    Therefore, always mention the version of database when you post specific requests as features differ from one version to the next.

    Concerning

  • How to convert a timestamp varchar2 column (3)

    Hi all

    I have a column of field date with varchar2 data type:

    Date
    ----------
    13/03/2011 10:22
    13/03/2011 10:22


    I tried this:
    select to_timestamp(date,'HH24MI') from dual;
    IAM getting this error:

    ORA-01858: a non-digit character was found here where was waiting for a digital
    I want to convert date timestamp column (3) column

    846773 wrote:

    I want to convert date timestamp column (3) column

    TIMESTAMP is not time column. Look at him as a date with a better accuracy - it supports the franctional part of a second. In any case, use:

    Select to_timestamp (date, "DD/MM/YYYY HH: mi AM'") twice;

    SY.

  • Align the text of the varchar2 column data

    Hello

    It is in reference below thread:
    Re: Align the text of varchar2

    I think I should post my question in this forum, rather than General database,

    I created a table and inserted the same that in the thread that above, and when I said:
    Select ID, FILLED_TEXT(DESCRIPTION,30) FROM T;

    It does not show the data in the column as aligned in 30 word boundaries. I thought, that I would be able to resolve the issue with the help of the http://soft.buaa.edu.cn/oracle/bookshelf/Oreilly/prog2/ch11_02.htm link, but failed.

    Kindly help me more.

    Kind regards.

    Okay, so you're saying there is already a tags in the code to indicate where the line breaks are necessary, so a small adjustment of the data to include these tags and also the code...

    DROP TABLE test_data
    /
    CREATE TABLE test_data as
    select 1 as id, q'[For several days after leaving Nantucket, nothing above hatches was seen of Captain Ahab. The mates regularly relieved each other at the watches, and for aught that could be seen to the contrary, they seemed to be the only commanders of the ship; only they sometimes issued from the cabin with orders so sudden and peremptory, that after all it was plain they but commanded vicariously.<>Yes, their supreme lord and dictator was there, though hitherto unseen by any eyes not permitted to penetrate into the now sacred retreat of the cabin.]' as txt from dual union all
    select 2, q'[Every time I ascended to the deck from my watches below, I instantly gazed aft to mark if any strange face were visible; for my first vague disquietude touching the unknown captain, now in the seclusion of the sea, became almost a perturbation. This was strangely heightened at times by the ragged Elijah's diabolical incoherences uninvitedly recurring to me, with a subtle energy I could not have before conceived of. But poorly could I withstand them, much as in other moods I was almost ready to smile at the solemn whimsicalities of that outlandish prophet of the wharves.<> But whatever it was of apprehensiveness or uneasiness - to call it so - which I felt, yet whenever I came to look about me in the ship, it seemed against all warrantry to cherish such emotions. For though the harpooneers, with the great body of the crew, were a far more barbaric, heathenish, and motley set than any of the tame merchant-ship companies which my previous experiences had made me acquainted with, still I ascribed this - and rightly ascribed it - to the fierce uniqueness of the very nature of that wild Scandinavian vocation in which I had so abandonedly embarked. But it was especially the aspect of the three chief officers of the ship, the mates, which was most forcibly calculated to allay these colorless misgivings, and induce confidence and cheerfulness in every presentment of the voyage. Three better, more likely sea-officers and men, each in his own different way, could not readily be found, and they were every one of them Americans; a Nantucketer, a Vineyarder, a Cape man. Now, it being Christmas when the ship shot from out her harbor, for a space we had biting Polar weather, though all the time running away from it to the southward; and by every degree and minute of latitude which we sailed, gradually leaving that merciless winter, and all its intolerable weather behind us. It was one of those less lowering, but still grey and gloomy enough mornings of the transition, when with a fair wind the ship was rushing through the water with a vindictive sort of leaping and melancholy rapidity, that as I mounted to the deck at the call of the forenoon watch, so soon as I levelled my glance towards the taffrail, foreboding shivers ran over me. Reality outran apprehension; Captain Ahab stood upon his quarter-deck. End]' from dual
    /
    
    CREATE OR REPLACE FUNCTION wordwrap (p_txt IN VARCHAR2, p_linesize IN NUMBER) RETURN t_wordwrap_txt PIPELINED IS
      cursor cur_wordwrap(p_txt in varchar2) is
        select rn, txt
        from (
              select rownum as rn
                    ,trim(regexp_substr(p_txt,'.{1,'||p_linesize||'}( |$)',1,rownum)) as txt
              from dual
              connect by rownum <= ceil(length(p_txt)/p_linesize)+10
             )
        where txt is not null
        order by rn;
      v_txt varchar2(4000);
      v_length number := 0;
      v_paratxt varchar2(4000) := p_txt;
      v_paratxt_part varchar2(4000);
      v_pos number;
      v_srch varchar2(100) := '<>';
    begin
      loop
        exit when v_paratxt is null;
        v_pos := instr(v_paratxt,v_srch);
        v_paratxt_part := case when v_pos = 0 then v_paratxt else substr(v_paratxt,1,v_pos-1) end;
        v_paratxt := case when v_pos = 0 then null else trim(substr(v_paratxt,v_pos+length(v_srch))) end;
        for w in cur_wordwrap(v_paratxt_part)
        loop
          v_txt := w.txt;
          loop
            exit when length(v_txt) = p_linesize or instr(v_txt,' ') = 0;
            for i in 1..p_linesize-length(v_txt)
            loop
              v_txt := regexp_replace(v_txt,'([^ ]) ','\1  ',1,i);
            end loop;
          end loop;
          v_length := v_length + length(v_txt);
          if length(v_txt) > 0 then
            pipe row(v_txt);
          end if;
        end loop;
        if v_paratxt is not null then
          pipe row(''); -- new line before next part
        end if;
      end loop;
      return;
    end;
    /
    

    results...

    SQL> select test_data.id, x.column_value
      2  from test_data, table(wordwrap(test_data.txt,50)) x
      3  /
    
            ID COLUMN_VALUE
    ---------- ---------------------------------------------------
             1 For  several days after leaving Nantucket, nothing
             1 above  hatches was seen of Captain Ahab. The mates
             1 regularly  relieved each other at the watches, and
             1 for aught that could be seen to the contrary, they
             1 seemed to be the only commanders of the ship; only
             1 they  sometimes  issued from the cabin with orders
             1 so  sudden  and  peremptory, that after all it was
             1 plain     they    but    commanded    vicariously.
             1
             1 Yes,  their  supreme  lord and dictator was there,
             1 though  hitherto  unseen by any eyes not permitted
             1 to  penetrate  into  the now sacred retreat of the
             1 cabin.
             2 Every  time I ascended to the deck from my watches
             2 below,  I  instantly  gazed  aft  to  mark  if any
             2 strange  face  were  visible;  for  my first vague
             2 disquietude  touching  the unknown captain, now in
             2 the   seclusion   of  the  sea,  became  almost  a
             2 perturbation.  This  was  strangely  heightened at
             2 times    by   the   ragged   Elijah's   diabolical
             2 incoherences  uninvitedly  recurring to me, with a
             2 subtle  energy  I  could not have before conceived
             2 of.  But poorly could I withstand them, much as in
             2 other  moods  I  was  almost ready to smile at the
             2 solemn  whimsicalities  of that outlandish prophet
             2 of                   the                  wharves.
             2
             2 But   whatever   it  was  of  apprehensiveness  or
             2 uneasiness  -  to  call  it so - which I felt, yet
             2 whenever  I  came to look about me in the ship, it
             2 seemed  against  all  warrantry  to  cherish  such
             2 emotions.  For  though  the  harpooneers, with the
             2 great  body of the crew, were a far more barbaric,
             2 heathenish,  and  motley  set than any of the tame
             2 merchant-ship    companies   which   my   previous
             2 experiences  had  made me acquainted with, still I
             2 ascribed  this  - and rightly ascribed it - to the
             2 fierce  uniqueness of the very nature of that wild
             2 Scandinavian   vocation   in   which   I   had  so
             2 abandonedly  embarked.  But  it was especially the
             2 aspect  of  the  three chief officers of the ship,
             2 the  mates,  which was most forcibly calculated to
             2 allay   these  colorless  misgivings,  and  induce
             2 confidence  and  cheerfulness in every presentment
             2 of   the   voyage.   Three   better,  more  likely
             2 sea-officers  and  men,  each in his own different
             2 way,  could  not  readily  be found, and they were
             2 every  one  of  them  Americans;  a Nantucketer, a
             2 Vineyarder,  a  Cape  man. Now, it being Christmas
             2 when  the  ship  shot  from  out her harbor, for a
             2 space  we had biting Polar weather, though all the
             2 time running away from it to the southward; and by
             2 every  degree  and  minute  of  latitude  which we
             2 sailed,  gradually  leaving that merciless winter,
             2 and  all its intolerable weather behind us. It was
             2 one  of  those  less  lowering, but still grey and
             2 gloomy  enough  mornings  of  the transition, when
             2 with  a fair wind the ship was rushing through the
             2 water  with  a  vindictive  sort  of  leaping  and
             2 melancholy rapidity, that as I mounted to the deck
             2 at  the  call  of the forenoon watch, so soon as I
             2 levelled   my   glance   towards   the   taffrail,
             2 foreboding  shivers  ran  over  me. Reality outran
             2 apprehension;   Captain   Ahab   stood   upon  his
             2 quarter-deck.                                  End
    
    65 rows selected.
    
    SQL>
    
  • Varchar2 column Max

    Hello

    Please let me know how to get the maximum varchar2.
    Table tab_code the two columns are varchar2.
    select * from tab_code;
    code    description
    001       code one
    004       code  two
    018       code three
    023       code four 
    203       code five 
    201       code six 
    problem: when I did max (code), it returns the 23 instead of 201.

    Thank you
    Sandy

    Sandy310 wrote:
    problem: when I did max (code), it returns the 23 instead of 201.

    Really? Can you give an example?

    If you want the digital maximum, use the TO_NUMBER() function:

    MAX(TO_NUMBER(code))
    

    Always store numbers as numbers strings not :)

Maybe you are looking for

  • Satellite 1900-102 CD - driver RW endangered

    HelloJust recently my cd player gave up work. I quickly relised that the computer does not recognize the cd drive is there and its pilots are no longer present. However, whenever I start the computer it says new hardware to install and makes cd playe

  • Problems when you try to play Texas Hold em

    When you try to play Texas Hold em, I get to 'Play now' and no further. There is a simple solution, but there is no need to be corrected download prompt. Help

  • Can I burn wmv large files on DVD - like WMV without modifying the files?

    the files are about 300 MB each1280 * 720 on 3900kbp. I want to make sure it works on all windows computers - and be played directly from the DVD mak! can I do this? He will be able to be played on specific dvd drives with a speed minimum (for exampl

  • Elimination of the effects of colored faces disco lights

    Dear allI'm trying to find a way to light effect multicolored spots dealing on the faces that were caused by a disco lighting. I would be very grateful for any help and advice. I use photoshop cc. If anyone can direct me to a video tutorial that woul

  • How to convert .swf exe?

    When I try to convert a. swf file using Adobe FlaHS Player 17 using the thing 'Create projector', the option Igray s. What can I do? Is there another program to convert swf to exe?