Concatenation of field - work around null values

Hello

I was hoping I could get assistance or advice on an issues I'm having with the concatenation of several fields. Esentailly, I need to concatenate a number of fields in another column (ALL_COMMENTS) using the carriage return and line break between each of them, however, I must also ensure that are no null values in all areas that will create blank lines within the new column.

Assuming that all the fields are varchar (255) Code is something like:

Update my_table
the value of ALL_COMMENTS == PART_COMMENT0 | CHR (13) | CHR (10) | PART_COMMENT1 | CHR (13) | CHR (10) | PART_COMMENT2 | CHR (13) | CHR (10) | PART_COMMENT3 | CHR (13) | CHR (10) | PART_COMMENT4 | CHR (13) | CHR (10) | PART_COMMENT5 | CHR (13) | CHR (10) | PART_COMMENT6;
COMMIT;

Can someone suggest a method to ensure that no blank line is included in the concatenated field (IE not null values in comments which allows line or carriage returns)

See you soon

Sorry I should have also mentioned that there is no structure for the data set and a null value can be in all areas PART_COMMENT.

Thank you

Published by: user11305352 on 07/05/2009 22:19

Maybe something like that

update my_table
   set all_comments =   part_comment0 || decode(part_comment0, null, null, chr(13) || chr(10)) ||
                  part_comment1 || decode(part_comment1, null, null, chr(13) || chr(10)) ||
                  part_comment2 || decode(part_comment2, null, null, chr(13) || chr(10)) ||
                  part_comment3 || decode(part_comment3, null, null, chr(13) || chr(10)) ||
                  part_comment4 || decode(part_comment4, null, null, chr(13) || chr(10)) ||
                  part_comment5 || decode(part_comment5, null, null, chr(13) || chr(10)) ||
                  part_comment6;

Tags: Database

Similar Questions

  • How to leave db field with a Null value if no value is entered in the form?

    I have a short form that has optional fields. If the optional fields are not filled in the form, I want to leave the field with a Null value in the SQL db. SQL columns allow Null, but whenever this code runs, it seems to insert a space rather than leave the field with a null value. I forget to do?

    Here is the solution...

  • Join does not work for NULL values on the join condition

    Hello

    I have the following problem.

    SQL > select * from a;

    X Y
    ---------- --------------------
    1
    2
    3
    4

    SQL > select * from b;

    A:
    ---------- --------------------
    1
    2



    SQL > select f.x, f.y, s.b in f, s b
    2 where f.x = s.b (+);
    X Y B
    ---------- -------------------- ----------
    1 1
    2 2
    4
    3




    SQL > select f.x, f.y, s.b in f, s b
    2 where f.x = s.b (+)
    3 and f.y = s.y;

    no selected line


    So now if I include a join condition more where null = null situation arises, it's working now.
    Just tell her not to treat (1 and null) (1 and null) are the same.
    What is the solution. This is an expected behavior.


    Thank you
    Pramod Garre

    Pramod salvation,

    Another way to use the outer join is,

    Select f.x, f.y, s.b
    of a, f, s b
    where f.x = s.b (+)
    and nvl(f.y,0) = nvl (s.y (+), 0);

    Hope this will help you.

    Thank you
    Amit

  • See the region if the recordset field is (not) "null."

    Facing another problem. The solution is probably going to be very simple, but so far I have not thought of her. That's what I'm looking for:

    Say you have a page with the title, the introduction of message and a news reading, more button. The table in which the ballots are stored got 5 columns:

    • ID (primary key, I)
    • date_entry (timestamp)
    • newstitle
    • newsintroduction
    • newsmessage (may be NULL)

    As you can see, the "newsmessage" column can be NULL because sometimes there are short messages. What I want to know is, if the "newsmessage" column is null, on the page that displays the records of news, the link "read more" should not be visible. It should show only when the "newsmessage" column is "not null", so got content inside.

    Thank you!

    Is this really a region you want to show or hide? I guess it could be, but DW normally like it better when the "region" is its own row of the table. I don't know how much time, even when I do not select the TR tag in the property inspector and apply a show or Hide Server behavior, DW still places the code inside the TR tag in the source code.

    So, basically, want you want to do is wrap the a tag that contains the text read more, in an If statement. I don't have the exact syntax for you, my PHP skills are still developing. Maybe an other people could help - or if you do not have a behavior show or hide (when the recordset is empty or non-empty), take a look at the way this code is structured and use it as a guide. But if you use Null/Not Null as your requirement, make sure that the field contains a null value.

  • Concatenate - how to get rid of "null null" values defult in field.

    I have concatenated with success the first and last name fields in the design of the form, but when I open/run form the concatenated field (FullName) by default is "null null" on the Form Design.png form. I want it to be empty, until the user enters data into the fields FirstName and LastName.

    I'm not an experienced Java script engine and need to have the full script, exactly as it should be entered from end to end.

    Here's what's in the current script script editor:

    Form1. Subform1.FullName::calculate - (JavaScript, client)

    var = form1 first. Subform1.FirstName.RawValue;

    var last = form1. Subform1.LastName.RawValue;

    this.rawValue = first + "" + last;

    LiveCycle Designer ES2

    Windows 8

    Post edited by: PenEliz1, I have added a screenshot.

    You just need to do a check of the Null value.

    var = form1 first. Subform1.FirstName.RawValue;

    var last = form1. Subform1.LastName.RawValue;

    If (first! = null & last! = null) {}

    this.rawValue = first + "" + last;

    }

    Sofiane

  • Null value in the Datetime field

    I have a form that inserts data, but the date fields have a value default (01/01/1900 12:00:00 AM) even if I do not insert a value for this field. How to enter a NULL value in the fields of datatime value MSSQL.instead default (01/01/1900 12:00:00 AM) that gets inserted?

    Here's my insert statement.

    < type CFLOCK = "exclusive" timeout = "10" >
    < name CFQUERY = "InsertWorkflow."
    DataSource = "" #request.app.DSN # ""
    username = "" #request.app.bsruser # ""
    Password = "#request.app.bsrPassword #" >
    INSERT INTO #request.app.DB # .v_NAR_WorkFlowLog
    ([SatApp_ID]
    [User_ReqApproval_Logon]
    [User_ReqApproval_Date]
    [Admin_ReqProcessed_Logon]
    [Admin_ReqProcessed]
    [Prelim_Approval_Level]
    [Prelim_Approval_Date]
    [Prelim_Approval_Explain]
    [Req_Withdrawn_Date]
    [Req_Withdrawn_Explain]
    [Req_Denied_Date]
    [Req_Denied_Explain]
    [User_Req_FinalAppl_Date]
    [Admin_FinalAppl_Date]
    [DateLastUpdated]
    [UpdatedBy])
    VALUES
    (#SatApp_ID #)
    , "#User_ReqApproval_Logon #
    , "#User_ReqApproval_Date #
    , "#Admin_ReqProcessed_Logon #
    , "#Admin_ReqProcessed #
    , "#Prelim_Approval_Level #
    , "#Prelim_Approval_Date #
    , "#Prelim_Approval_Explain #
    , "#Req_Withdrawn_Date #
    , "#Req_Withdrawn_Explain #
    , "#Req_Denied_Date #
    , "#Req_Denied_Explain #
    , "#User_Req_FinalAppl_Date #
    , "#Admin_FinalAppl_Date #
    , "#DateLastUpdated #
    ("#UpdatedBy #")
    < / CFQUERY >
    < / CFLOCK >

    Thank you

    Shearak

    CFQueryParam would work? For example:

    So, using your example, this would be your insert:


       
    DataSource = "" #request.app.DSN # ""
    username = "" #request.app.bsruser # ""
    Password = "" #request.app.bsrPassword # ">"
    INSERT INTO #request.app.DB # .v_NAR_WorkFlowLog
    ([SatApp_ID]
    [User_ReqApproval_Logon]
    [User_ReqApproval_Date]

    [Admin_ReqProcessed_Logon]
    [Admin_ReqProcessed]
    [Prelim_Approval_Level]
    [Prelim_Approval_Date]
    [Prelim_Approval_Explain]
    [Req_Withdrawn_Date]
    [Req_Withdrawn_Explain]
    [Req_Denied_Date]
    [Req_Denied_Explain]
    [User_Req_FinalAppl_Date]
    [Admin_FinalAppl_Date]
    [DateLastUpdated]
    [UpdatedBy])
    VALUES
    (#SatApp_ID #)
    , "#User_ReqApproval_Logon #
    , "#User_ReqApproval_Date #
    , "#Admin_ReqProcessed_Logon #
    , "#Admin_ReqProcessed #
    , "#Prelim_Approval_Level #
    , "#Prelim_Approval_Date #
    , "#Prelim_Approval_Explain #
    , "#Req_Withdrawn_Date #
    , "#Req_Withdrawn_Explain #
    , "#Req_Denied_Date #
    , "#Req_Denied_Explain #
    , "#User_Req_FinalAppl_Date #
    , "#Admin_FinalAppl_Date #
    (, ' #UpdatedBy # ')
       

  • Eloqua recommended way to identify records with a null value in a specific field?

    What is the recommended Eloqua the way to identify records with a null value in a specific field in a contact filter.  For example, in the segment 'lead State cleaning-11/21/12', I look for records with a value zero in LeadID and ContactID... How Eloqua recommends to do this?

    Replied to your message here: http://topliners.eloqua.com/message/19075#19075

  • I have a HTML5 form that sends a null (%) if the user does not have a choice. It works fine, but I get an error of W3c on the value of '% '. Is there another way to send a NULL value?

    I have an HTML5 form that allows the user to select 1 of 6 provinces of Costa Rica. If they do not select a Province, I use php code to send a NULL value and the other selections research of the form looking for all Provinces. If they choose a province, we are looking for database records that are found in this province.  Currently I use the value = '%' as the selected value if the user does not have a choice. It works and looks in all provinces, but I get an error of W3c checking on the value = '% '. Y at - it another way to send a NULL value. PS: I have the same problem on the following form which allows you to select the Business category. The page is http://www.yellowpagescr.com

    Here is a copy of the code. The RED line works but gets a W3c issue error of the test page. :

    < form = class "navbar-form Center navigation bar" role = "Search" action = "#searchresults" method = "get" name = "selectterms" id = "selectterms" title = "" >

    < select name = "province" autofocus class = 'copyright' title = "Click to select a Province (optional)" >

    < option value = '%' selected = "selected" > all Provinces < / option >

    < option value = "alajuela" > Alajuela < / option >

    < option value = "cartago" > Cartago < / option >

    < option value = "Guanacaste" selected > Guanacaste < / option >

    < option value = "heredia" > Heredia < / option >

    < option value = "Limon" > Limon < / option >

    < option value = "Puntarenas" > Puntarenas < / option >

    < option value = "San Jose" > San Jose < / option >

    < option value = "Other" > other < / option >

    < / select >

    The correct way.

    Nancy O.

  • calculated formula database field trying to insert the null value

    Hello

    I have 3 elements of database text amount, rate and result.
    I enter both values (quantity and frequency), and the property using formula 'result' Gets the computed value.
    On the screen all the values are displayed correctly but when trying to save my information text field 'result' tent to insert the null value.

    Any suggestions?

    Forms 11g

    Thanks in advance

    794018 wrote:
    Hello

    I have 3 elements of database text amount, rate and result.
    I enter both values (quantity and frequency), and the property using formula 'result' Gets the computed value.
    On the screen all the values are displayed correctly but when trying to save my information text field 'result' tent to insert the null value.

    Point formula should not be issue of database. And insert the value in the result column in the database is not good idea.
    Then, if you want to save it. create the database result item and write trigger (When-validate-point) on amount and filed rates and the trigger code, write

    :result:=:amount*:rate;
    

    To display the result on the form, create the database no item and change the formula property and write the formula.

    Hope this will help you

    If someone useful or appropriate, please mark accordingly.

  • 2.1 ai2 - Export using "fixed" merges the fields in the presence of null values

    If you have a result set that includes NULL values and export you them to 'Fixed' format, any NULL field does not include spaces appropriate between it and the next field. Here's a test case and an example of the problem:

    create table TEST_EXPORT (ID number, varchar2 (100) Field1, Field2 varchar2 (100), FIELD3 varchar2 (100));
    insert into TEST_EXPORT values (1, ' line 1 - zone 1 ","line 1 - zone 2 ","line 1-3 field ');
    insert into TEST_EXPORT values (2, ' line 2 - zone 1 ", null, 'line 2-3 field');
    Insert into TEST_EXPORT values (3, 'line 3 - zone "line 3 - zone 2", "3 - zone 3" line 1 ");
    insert into TEST_EXPORT values (4, ' line 4 - zone 1 ", null, null);
    Insert in the TEST_EXPORT values (5, null, null, null);
    commit;
    Select * from TEST_EXPORT by id;


    Then, right-click on the result set, export data, set the Clipboard

    As you can see here, the NULL fields have no space after the "":

    'ID' 'FIELD1', 'FIELD2' "FIELD3".
    "1" "line 1 - field 1" "line 1 - field 2" "line 1 - field 3" "."
    "2' ' line 2 - field 1" "" "line 2 - field 3" "". "
    "3' ' line 3 - field 1" "line 3 - field 2" "line 3 - field 3" "."
    "4' ' line 4 - field 1" ' ' "."
    "5" """"""


    Here is my version SQLDeveloper data:

    Oracle SQL Developer 2.1.0.63
    Version 2.1.0.63
    Build a HAND - 63.10
    Copyright © 2005,2009 Oracle. All rights reserved.
    The IDE version: 11.1.1.2.36.55.23
    Product ID: oracle.sqldeveloper
    Product version: 11.1.1.63.10

    Version of the component
    =========     =======
    Java (TM) Platform 1.6.0_11
    Oracle IDE 2.1.0.63.10
    Support versioning 2.1.0.63.10

    Bug 9182502 - OTNFORUM: FIXED TRAINER is not EXPORT NULL COLUMNS CORRECTLY... filed and fixed

  • How to return a NULL value in LOV and insert into a field of allowingNULL number 4?

    Hello

    I have the following LOV and the return_value is PeopleId which is number 4, allowing NULL. And the LOV options are as follows:

    LOV named--> select named LOV-
    Show Extra values-> no
    Dynamic translation-> - untranslated-
    The number of columns - > 1
    Display Null-> Yes
    Null-> - Select value-
    Return NULL,-> NULL value
    ^^^^^^^^^^^^^^^

    ----------------

    List of values definition:
    Select Lname | ', ' || Fname | ' ' || Mname as display_value, PeopleId as return_value
    of PEOPLETB
    where PEOPLETYPE ('i', 'HERE', 'IF')
    order by 1
    --------------

    Given that PoepleId is a number 4, allowing NULL. I want a NULL value will be inserted, if the user does not select anything in the drop-down list. It seems that I would get "ORA-01722: invalid number" error when the PeopleId msg is null (ie: user doesn't have a selection). What is the good 'return Null value' I need to put it in? I tried "NULL" (see above) or nothing, it still does not work.

    Any suggestions?

    Thank you very much
    Helen

    Hello Helen,.

    You have found one of the many sources of my frustration with APEX. Here's what I do:

    In the definition of the element in your page, go to the LOV part and implemented like this:

    Display Extra values: Yes a dynamic conversion (I ignore this)
    Number of columns: 1 display Null: No.
    Display null value: (leave blank) return Null value: (leave blank)

    An empty row is displayed when the user comes first to the screen. If they do NOT select the drop-down list, the value is left empty (null).

    If anyone has a better way, I will definitely experiment with it.

    Don.

  • How to implement 'Null value replace' inside a RTF

    Hello

    This is my area:

    <? for-each - group:current-group(); / RP_CURRENCY? >

    <? If: RP_CURRENCY = "ABOVE"? >

    <? for-each - group:current-group(); / RPT_DESCRIPTION? >

    <? If: RPT_DESCRIPTION = 'debit card '? >

    <? sum (current - group () / RP_CI_EQUIVALENT_CALC)? >

    <? end if? >

    <? end for each group -? >

    <? end if? >

    <? end for each group -? >

    If this field does not always reach the sum, and then returns a NULL value. I need it to return 0 instead, but I think I'm this overload since RTF are not flexible.

    I tried to reach '+ 0' at the end and it works when its null, but if the number is not null, then it adds a 0 to the result rather than adding it.

    The XML code is attached.

    Please use this amount

    And the code below will be more optimized for performance and maintenance.

  • How can I run my validations after confirming that a specific field is not NULL?

    Hello

    How can I run my validations after confirming that a specific field is not NULL?

    One of my validation needs to ensure that a specific page element is not NULL, then I use the option 'required value' of the page element, but it seems that the validation is performed before the option "required value.

    I know I could create 2 different validations for each case, but I think it would be nicer if I could work through the only validation and leave the APEX to manage the field validation is NOT NULL

    Best regards and thanks for reading

    According to my experience, it appears that the APEX is going through all THE postings...

    IE, if a "failure" of Validation continues.

    It's actually beneficial for the end user, because it will get ALL the errors in the form he or she made... not just a first.

    workaround solution:

    1. Remove the 'required' on the element value (.. but keep the "required" model)
    2. Add the NOT NULL check to your personal validation process.

    Very probably, the 2nd one will be in a PL/SQL function return error text.

    MK

  • Ideas for work around ORA-06502: character string buffer too small on the interactive report

    Hello

    It comes to Apex 4.2.  We try to create an interactive report.  The report is for something similar at a follow-up time.  We try to concat a comments column as the sum of the hours.  For example,.

    Select TASK_NAME, sum (HOURS), to_char (XMLAGG (XMLELEMENT(E,E.COMMENTS ||) ' : ')). Extract ('//Text ()'). GETSTRINGVAL()) USER_COMMENTS of...

    This query works fine if we seek only to a window of 1 week.  The question that we live, when we expand the scope of the query to include data from 3 months, we hit ORA-06502 interactive report.  If we remove this column from the interactive report, then the report works very well.

    Anyone has any ideas on how we might be able to work around this problem?  I'm guessing we're reached the limit of 32 k on the report.  Ideally, we would show just the last X number of comments and then have a link to show all comments

    Any help would be appreciated

    Thank you

    Mike

    ListAGG raises an ORA-01489 for varchar2 > 4000 bytes

    OP has an ORA - 06502--> IR is running within a limit of 4 k / 32 k.

    quick fix: wrap USER_COMMENTS ListAGG in a substr (..., 1, 4000)

    Longer solution, use a subquery to modify comments based on ROW_NUMBER() (IE after the nth line, change the null)

    with
    -- simulating data
    t as (select task_id, sysdate - lv as date_entered
      ,round(dbms_random.value(1,24)) hours
      , '-*' || lv || '.' || task_id || '*-' as user_comments
    from ( select level as task_id from dual connect by level <=10 ), (select level lv from dual connect by level < 1000)
    ),
    -- modify data
    modified_data as (
      select task_id, hours, date_entered
        ,case
          when row_number() over (partition by task_id order by date_entered desc) < 5
            then user_comments
          else null
         end USER_COMMENTS
        from t)
    select task_id, sum(hours) total_hours,
      listagg( user_comments  ) within group (order by date_entered desc)
      || case when count(*) >= 5 then '! MORE COMMENTS !' else null end
        as user_comments
    from modified_data
    group by task_id;
    
  • NULL value in the print result

    I run a SELECT statement on the form below:

    SELECT col1 |' | ' || col2 |' | ' || COL3

    TABLE;

    It gives me the following outprint, which is what I need

    col1 | col2. col3

    VARCHAR2. number | VARCHAR2

    The problem is when col2 returns a NULL value, then I get this:

    VARCHAR2. VARCHAR2

    When what I want is this:

    VARCHAR2. (null) | VARCHAR2

    Is it possible to get my results of the query to print the value NULL (null)?

    I tried the function NVL NVL (col2, 'null'), but it won't work because there is a mismatch on data types. I can get the NULL value, printed by concatenating don't not columns and save results to csv, but that does not give me the formatting that I want.

    You can convert the character number column, and then look for the NVL.

    See below:

    with data as
    (
      select 'col1' col1, 1 col2, 'col3' col3 from dual union all
      select 'col1' col1, null col2, 'col3' col3 from dual
    )
    select col1 || '|' || nvl(to_char(col2), 'null') || '|' || col3
      from data;
    
    COL1||'|'||NVL(TO_CHAR(COL2),'NULL')||'|'||COL3
    --------------------------------------------------
    col1|1|col3
    col1|null|col3
    

Maybe you are looking for

  • When Apple's QuickTime Windows available 10?

    For those of us in the video editing field that surprise us in the Apple no longer offers QuickTime for Windows 10. I guess that's the way to Apple to force us to use Final Cut Pro. Not going not to happen...

  • WAG320N and PLK300 connection problems

    Hello everyone and thanks for your help. I recently bought a WAG320N Gigabite modem-router to replace the modem router provided by (in principle less powerful) internet service provider. Previously, I have a Zyxel (MOD. P660HW-D1) wireless router. Th

  • How to recover the natural color of Windows?

    OT: Screen colorsThe colors on my screen changed to negative colors. I use Windows 7 and Don t know how to get back to normal colors, thank you very much for your help!

  • Change my settings for MAPI in Windows Live Mail.

    original title: CHANGE MY MAPI SETTINGS Am running Windows 7 and just updated to update my windows live mail and now I can't get my accounting software to send emails - keeps telling me to change my settings to MAPI.  Always had to manually select Wi

  • How can I register in my outlook

    How can I register in my outlook. Tell how to sign out in Microsoft outlook.