upsert xmltype data xpath - missing something obvious?

Version: 10.2.0 * 2 * EA

I'm doing a upsert (update / insert) of an xmltype for a given xpath.

The xml data is passed as an xmltype, xpath is a string (varchar2), the new value is a string, varchar2.

If the node specified by the xpath expression exists it is trivial using updatexml; of course if the node is not nothing happens. I can verify the existence of nodes using is node, but I just take off, trying to figure out how to insert the node.

All the APIs I can find who to insert XML (APPENDCHILDXML, INSERTXMLBEFORE, INSERTCHILDXML) do not take an xpath but require an xmltype. Which means that if I'm reading this right I have no other choice to the parse varchar2 string xpath to create an xmltype (ugh!).

I can't find any API that takes an xpath as a varchar2 and a value and gives me an xmltype. Ideally I want same, here an API that returns the XML updated which took the set xpath to update (or inserted if it did not exist) with the new value.

I'm not an XML expert but I'm pretty handy with SQL and PL/SQL. For me this seems incredibly heavy just to do something as mundane as an upsert, so I hope I'm missing something obvious!

Can soemone please put me everything right with a pointer or an example?

On top of the XML uses namespaces, but they are not registered, there is no record of current schema.

Marco Gralike wrote:
Could not be done through XQuery, although the version of database doesn't really help...

It would be possible with a dynamic, but 'painful' XQuery with a static expression expression because it would require parsing the XPath expression and rebuild the entire document of entry with the necessary adaptations.
I think XSLT would be more effective in this case.

Perhaps, one day, when the database is XQuery Update Facility, we will be able to do:

copy $a := $doc/Address
modify (
  if ($a/zip)
    then replace value of node $a/zip with "12345"
    else insert node element zip {"12345"} into $a
)
return $a

user12083137 wrote: for me, from a SQL background, I can't believe this simple case is simply not covered.

Perhaps not as simple as it sounds. :)

The feature can be simulated by an IF/THEN/ELSE logic, or a DELETE/INSERT sequence.
For example:

case when existsNode(doc, xpath) = 1
  then updateXML(
         doc
       , xpath || '/text()'
       , somevalue
       )
  else appendchildxml(
         doc
       , substr(xpath, 1, instr(xpath, '/', -1)-1)
       , xmlelement(
           evalname(substr(xpath, instr(xpath, '/', -1)+1))
         , somevalue
         )
       )
end

or,

appendChildXML(
  deleteXML(doc, xpath)
, substr(xpath, 1, instr(xpath, '/', -1)-1)
, xmlelement(
    evalname(substr(xpath, instr(xpath, '/', -1)+1))
  , somevalue
  )
)

Tags: Database

Similar Questions

  • SQL Developer 3 - export truncates the XMLType data

    I am train to export data from and column XMLType & its getting truncated.
    I've tried insert formats, text, html, and csv. Big data gets truncated to 4000 characters, but its not exactly consistent.

    Is this all just not supported in SQL Developer, or am I missing something simple?

    You are right that there is currently a maximum of 4000 characters when exporting large data types.

    You can add your voice to feature requests SQL Developer using feature requests to the SQL Developer Exchange. This is not only ensures we remember, but also gives all users the chance to make their right to vote for features and provides a forum for you (the user base) to reflect on the way you prefer it works.

    SQL development team
    Joyce Scapicchio

  • How to access the hard drive USB on E3000? Am I missing something?

    I have my router configuration fine to the internet, as well as the media server.  I can't understand how to access the hard drive of my laptop, however.  The manual says to put 192.168.1.1 in the field the address of windows Explorer, but it gives me just the 'Setup' page for the router.

    Am I missing something simple?  I use Windows XP.

    Click on start - go to start > Run/start search and type "\\192.168.1.1" (without the quotes) and press on enter and it should ask the user name and password, the user name and password, use "admin" all lower case, and then click Ok... Now you should be able to see your USB... You must make a right click on it and select "Map network drive" and check the Enable box and below click Finish... It will map the USB on your computer... Once done, you will be able to send and receive data from your computer to the USB...

  • Number with gestures. Am I missing something?

    Hi all, I was experimenting with the sample of gestures of https://github.com/blackberry/NDK-Samples/tree/ndk2/Gesture ... I wanted to do something when a tap gesture were found (some processing and registration for the file...)...

    I noticed that after the treatment, the gestures would stop working...

    I was able to recreate the problem simply by putting a 2 second delay in the section of the tap of the gestures of the Gesturs sample application standard callback function...  I am pasting the main.c below...

    I tried searching in the gesture API on delays documentation or any configuration of the time-out option, but could not find something... am I missing something? How can I recover when it arrives? (of course I could put the personalised treatment in another thread, but I don't need this way, and I don't see why it wouldn't work...). Anyone else having this problem?

    This is the code:

    /*
    * Copyright (c) 2011-2012 Research In Motion Limited.
    *
    * Licensed under the Apache License, Version 2.0 (the "License");
    * you may not use this file except in compliance with the License.
    * You may obtain a copy of the License at
    *
    * http://www.apache.org/licenses/LICENSE-2.0
    *
    * Unless required by applicable law or agreed to in writing, software
    * distributed under the License is distributed on an "AS IS" BASIS,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
    
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    #include 
    
    #include "input/screen_helpers.h"
    #include "gestures/double_tap.h"
    #include "gestures/pinch.h"
    #include "gestures/set.h"
    #include "gestures/swipe.h"
    #include "gestures/tap.h"
    #include "gestures/two_finger_pan.h"
    
    #define MIN_VIEWPORT_SIZE 128
    #define MAX_VIEWPORT_SIZE 4096
    screen_context_t screen_ctx;
    screen_window_t screen_win;
    static bool shutdown;
    struct gestures_set * set;
    const char* img_path = "app/native/wallpaper.jpg"; /* Relative path to image asset */
    int viewport_pos[2] = { 0, 0 };
    int viewport_size[2] = { 0, 0 };
    int last_touch[2] = { 0, 0 };
    
    /**
     * The callback invoked when a gesture is recognized or updated.
     */
    void
    gesture_callback(gesture_base_t* gesture, mtouch_event_t* event, void* param, int async)
    {
        if (async) {
            fprintf(stderr,"[async] ");
        }
        switch (gesture->type) {
            case GESTURE_TWO_FINGER_PAN: {
                gesture_tfpan_t* tfpan = (gesture_tfpan_t*)gesture;
                fprintf(stderr,"Two finger pan: %d, %d", (tfpan->last_centroid.x - tfpan->centroid.x), (tfpan->last_centroid.y - tfpan->centroid.y));
                if (tfpan->last_centroid.x && tfpan->last_centroid.y) {
                    viewport_pos[0] += (tfpan->last_centroid.x - tfpan->centroid.x) >> 1;
                    viewport_pos[1] += (tfpan->last_centroid.y - tfpan->centroid.y) >> 1;
                }
                break;
            }
            case GESTURE_PINCH: {
                gesture_pinch_t* pinch = (gesture_pinch_t*)gesture;
                fprintf(stderr,"Pinch %d, %d", (pinch->last_distance.x - pinch->distance.x), (pinch->last_distance.y - pinch->distance.y));
    
                int dist_x = pinch->distance.x;
                int dist_y = pinch->distance.y;
                int last_dist_x = pinch->last_distance.x;
                int last_dist_y = pinch->last_distance.y;
    
                int reldist = sqrt((dist_x)*(dist_x) + (dist_y)*(dist_y));
                int last_reldist = sqrt((last_dist_x)*(last_dist_x) + (last_dist_y)*(last_dist_y));
    
                if (reldist && last_reldist) {
                    viewport_size[0] += (last_reldist - reldist) >> 1;
                    viewport_size[1] += (last_reldist - reldist) >> 1;
    
                    /* Size restrictions */
                    if (viewport_size[0] < MIN_VIEWPORT_SIZE) {
                        viewport_size[0] = MIN_VIEWPORT_SIZE;
                    } else if (viewport_size[0] > MAX_VIEWPORT_SIZE) {
                        viewport_size[0] = MAX_VIEWPORT_SIZE;
                    }
                    if (viewport_size[1] < MIN_VIEWPORT_SIZE) {
                        viewport_size[1] = MIN_VIEWPORT_SIZE;
                    } else if (viewport_size[1] > MAX_VIEWPORT_SIZE) {
                        viewport_size[1] = MAX_VIEWPORT_SIZE;
                    }
    
                    /* Zoom into center of image */
                    if (viewport_size[0] > MIN_VIEWPORT_SIZE && viewport_size[1] > MIN_VIEWPORT_SIZE &&
                            viewport_size[0] < MAX_VIEWPORT_SIZE && viewport_size[1] < MAX_VIEWPORT_SIZE) {
                        viewport_pos[0] -= (last_reldist - reldist) >> 2;
                        viewport_pos[1] -= (last_reldist - reldist) >> 2;
                    }
                }
                break;
            }
            case GESTURE_TAP: {
                gesture_tap_t* tap = (gesture_tap_t*)gesture;
                fprintf(stderr,"Tap x:%d y:%d delay 2000",tap->touch_coords.x,tap->touch_coords.y);
                // *** 2 sec delay to reproduce issue ***
                delay(2000);
                break;
            }
            case GESTURE_DOUBLE_TAP: {
                gesture_tap_t* d_tap = (gesture_tap_t*)gesture;
                fprintf(stderr,"Double tap x:%d y:%d", d_tap->touch_coords.x, d_tap->touch_coords.y);
                break;
            }
            default: {
                fprintf(stderr,"Unknown Gesture");
                break;
            }
        }
        fprintf(stderr,"\n");
    }
    
    /**
     * Initialize the gestures sets
     */
    static void
    init_gestures()
    {
        gesture_tap_t* tap;
        gesture_double_tap_t* double_tap;
        set = gestures_set_alloc();
        if (NULL != set) {
            tap = tap_gesture_alloc(NULL, gesture_callback, set);
            double_tap = double_tap_gesture_alloc(NULL, gesture_callback, set);
            tfpan_gesture_alloc(NULL, gesture_callback, set);
            pinch_gesture_alloc(NULL, gesture_callback, set);
        } else {
            fprintf(stderr, "Failed to allocate gestures set\n");
        }
    }
    
    static void
    gestures_cleanup()
    {
        if (NULL != set) {
            gestures_set_free(set);
            set = NULL;
        }
    }
    
    static void
    handle_screen_event(bps_event_t *event)
    {
        int screen_val, rc;
    
        screen_event_t screen_event = screen_event_get_event(event);
        mtouch_event_t mtouch_event;
        rc = screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &screen_val);
        if(screen_val == SCREEN_EVENT_MTOUCH_TOUCH || screen_val == SCREEN_EVENT_MTOUCH_MOVE || screen_val == SCREEN_EVENT_MTOUCH_RELEASE) {
            rc = screen_get_mtouch_event(screen_event, &mtouch_event, 0);
            if (rc) {
                fprintf(stderr, "Error: failed to get mtouch event\n");
            }
            rc = gestures_set_process_event(set, &mtouch_event, NULL);
    
            /* No gesture detected, treat as pan. */
            if (!rc) {
                if (mtouch_event.contact_id == 0) {
                    if(last_touch[0] && last_touch[1]) {
                        fprintf(stderr,"Pan %d %d\n",(last_touch[0] - mtouch_event.x),(last_touch[1] - mtouch_event.y));
                        viewport_pos[0] += (last_touch[0] - mtouch_event.x) >> 1;
                        viewport_pos[1] += (last_touch[1] - mtouch_event.y) >> 1;
                    }
                    last_touch[0] = mtouch_event.x;
                    last_touch[1] = mtouch_event.y;
                }
            }
            if (screen_val == SCREEN_EVENT_MTOUCH_RELEASE) {
                last_touch[0] = 0;
                last_touch[1] = 0;
            }
        }
    }
    
    static void
    handle_navigator_event(bps_event_t *event) {
        switch (bps_event_get_code(event)) {
        case NAVIGATOR_EXIT:
            shutdown = true;
            break;
        }
    }
    
    static void
    handle_events()
    {
        int rc, domain;
        bool has_events = true;
    
        while(has_events) {
            bps_event_t *event = NULL;
            rc = bps_get_event(&event, 50);
            assert(rc == BPS_SUCCESS);
            if (event) {
                domain = bps_event_get_domain(event);
                if (domain == navigator_get_domain()) {
                    handle_navigator_event(event);
                } else if (domain == screen_get_domain()) {
                    handle_screen_event(event);
                    /* Re-draw the screen after a screen event */
                    screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_SOURCE_POSITION , viewport_pos);
                    screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_SOURCE_SIZE , viewport_size);
                    screen_flush_context(screen_ctx,0);
                }
            } else {
                has_events = false;
            }
    
        }
    }
    
    static int decode_setup(uintptr_t data, img_t *img, unsigned flags)
    {
        screen_window_t screen_win = (screen_window_t)data;
        screen_buffer_t screen_buf;
        int size[2];
    
        size[0] = img->w;
        size[1] = img->h;
        screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, size);
        screen_create_window_buffers(screen_win, 1);
    
        screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)&screen_buf);
        screen_get_buffer_property_pv(screen_buf, SCREEN_PROPERTY_POINTER, (void **)&img->access.direct.data);
        screen_get_buffer_property_iv(screen_buf, SCREEN_PROPERTY_STRIDE, (int *)&img->access.direct.stride);
    
        img->flags |= IMG_DIRECT;
        return IMG_ERR_OK;
    }
    
    static void decode_abort(uintptr_t data, img_t *img)
    {
        screen_window_t screen_win = (screen_window_t)data;
        screen_destroy_window_buffers(screen_win);
    }
    
    int
    load_image(screen_window_t screen_win, const char *path)
    {
        img_decode_callouts_t callouts;
        img_lib_t ilib = NULL;
        img_t img;
        int rc;
    
        rc = img_lib_attach(&ilib);
        if (rc != IMG_ERR_OK) {
            return -1;
        }
    
        memset(&img, 0, sizeof(img));
        img.flags |= IMG_FORMAT;
        img.format = IMG_FMT_PKLE_XRGB8888;
    
        memset(&callouts, 0, sizeof(callouts));
        callouts.setup_f = decode_setup;
        callouts.abort_f = decode_abort;
        callouts.data = (uintptr_t)screen_win;
    
        rc = img_load_file(ilib, path, &callouts, &img);
        img_lib_detach(ilib);
    
        return rc == IMG_ERR_OK ? 0 : -1;
    }
    
    int
    main(int argc, char **argv)
    {
        const int usage = SCREEN_USAGE_WRITE;
    
        screen_buffer_t screen_buf = NULL;
        int rect[4] = { 0, 0, 0, 0 };
    
        /* Setup the window */
        screen_create_context(&screen_ctx, 0);
        screen_create_window(&screen_win, screen_ctx);
        screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_USAGE, &usage);
    
        load_image(screen_win, img_path);
    
        screen_get_window_property_pv(screen_win, SCREEN_PROPERTY_RENDER_BUFFERS, (void **)&screen_buf);
        screen_get_window_property_iv(screen_win, SCREEN_PROPERTY_BUFFER_SIZE, rect+2);
        viewport_size[0] = rect[2];
        viewport_size[1] = rect[3];
        screen_set_window_property_iv(screen_win, SCREEN_PROPERTY_SOURCE_SIZE , viewport_size);
    
        screen_post_window(screen_win, screen_buf, 1, rect, 0);
    
        init_gestures();
    
        /* Signal bps library that navigator and screen events will be requested */
        bps_initialize();
        screen_request_events(screen_ctx);
        navigator_request_events(0);
    
        while (!shutdown) {
            /* Handle user input */
            handle_events();
        }
    
        /* Clean up */
        gestures_cleanup();
        screen_stop_events(screen_ctx);
        bps_shutdown();
        screen_destroy_window(screen_win);
        screen_destroy_context(screen_ctx);
        return 0;
    }
    

    Yes, when I run the code above I get the same problem.  It seems that the two finger gestures and pinching are fly events and not 'fault', so that it goes to the tap gesture.  If I rearrange the gesture_allocs to this

    _tfpan = tfpan_gesture_alloc (& tfparams, cb, _gest_set);
    _pinch = pinch_gesture_alloc (& pinparams, cb, _gest_set);
    _double_tap = double_tap_gesture_alloc (& dtparams, cb, _gest_set);
    _tap = tap_gesture_alloc (& tparams, cb, _gest_set);

    This works.  But the double tap does not work, probably because it takes 2 pressures, and to know that you have only 1 tap must wait or get an idle screen event.  In this case, I guess you could buffer events and use gestures_set_process_event_list with the functions in event_list.h

    https://developer.BlackBerry.com/native/reference/BB10/com.QNX.doc.gestures.lib_ref/topic/about_even...

    In addition, time of the event is the time of the real event, not when you have received the event with bps_get_event.  Any delay should not affect the treatment of the gesture.

  • On my MBP, 2011, bar menu in recovery mode to offer only one option - selector of language. How do you get Terminal? Missing something?

    On my MBP, 2011, in recovery mode menu bar offers only a single - switch language option. How do you get Terminal? Missing something?

    You will need to choose your language first.

    From there on, the Terminal will be on the menu drop-down utilities > Terminal

  • I can't seem to open additional tabs with the +, the drop down menu, or T command? Is this a bug or am I missing something?

    Hello
    I can't seem to open additional tabs with the +, the drop down menu, or T command? Is this a bug or am I missing something?

    I use Firefox 30.0 in OS 10.8.5 on a Mac Book Pro with the Intel Core i7 2.7 GHz and 1333 MHz DDR3 8 GB memory.

    Thanks in advance,
    Pat

    You have a "Community Toolbar" extension installed? Which has been reported by other users of Mac as affecting the new tab feature in Firefox 30.

  • I set up the new user on my MacBook Pro with the parental control, and I want to allow access to Word, Excel, PowerPoint for Mac.  I have those checked in the dialog box list, but they may not appear in its applications. Am I missing something?

    I set up a 'user' for my son and use parental controls.  I want to him to have access to Word for Mac, and it appears in the list of applications I can check to allow use for.  However, when we opened a session under his username, these applications do not seem to be anywhere.  When you configure new users, applications such as Word for Mac or the available Pages on users?  I can't find any information to help in this regard.  I don't know if I'm missing something under user put up, or parental controls, or both.  Any help would be greatly appreciated!

    These requests should be made available, provided you installed then in the folder/applications, not in a private folder ~/Applications for a specific user.

  • The configuration of your Pc startup data is missing or contains errors: 0x000014c error code

    Hello

    See if any body can help here... I get this blue screen:

    ************

    RECOVERY

    Your PC needs to be fixed:

    The Configuration of your PC startup data is missing or contains errors.

    file:\\EFI\Microsoft\Boot\BCD

    Error code: 0xc000014c

    You will need to use the tools of recovery on your installation media. If you do not have any installation media (like a disk or a USB device), contact your system administrator or the computer manufacturer.

    Press ESC for UEFI firmware settings

    ******

    First of all, I could enter option 11 and run the factory reset, I was so happy because I thought it won't be easy... but then after I did the factory reset... I get this blue screen. If I press ESC I get into this next screen:

    F1 system information

    F2 System Diagnostics

    F9 boot device Options

    F10 BIOS Setup

    F11 recovery system

    ENTER - continue starting.

    This is what happens when I click on one of these options:

    F1, I enter the system of information without any problem, then I click on to continue and return to the screen last... so I press F2 and super, I'm able to run the Test of memory and hard drive check 100% without any problem in one of those who, after that I'm done with my tests I press exit and I'm back to F1 , F2, menu etc... now I want to try F9, F10 or F11. disappointment in this option 3 I go back to the blue screen described at the beginning of this post. (I already plug in a USB key with a bootloader, which works perfectly)

    so I can't do anything, nothing at all! crazzines.

    So what I did to check why I can't enter BIOS or at least to boot from my USB... I removed the lid of my laptop botton and removed the hard drive and is then, how I was or I am able to log in the BIOS - I made the changes to start USB first, then the HD and that's how I was able to boot from USB - BUT if I connect the hard drive back I'm not able to enter the BIOS or boot from USB - so basically I'm stuck in this blue screen and I can't boot from a USB key, if I connected HD... I can't use any option... no BIOS, nothing... So yet again, I disconnect the HD.

    This is one:

    HP ENVY Sleekbook TS 4

    If you can't access BIOS with the HDD connected, you certainly won't be able to start on the recovery USB. This is indicative of a failing hard drive.

    Install a new drive hard and then start on the recovery key.

  • Am I missing something? Where is the history of Web page?

    I just install the proposed updates and it has upgraded me to Internet Explorer 8, which is no longer guard the track of what I've been to Web pages (or anywhere that I can see...).  For example, I go to Google several times in one night.  Before, I could pull down the drop down bar at the top of the screen and it show me the history of navigation, including all sites, I had visited since the last time I had deleted the history.  Now, NONE of them are down down (in fact, it is not still drop more).

    Surely I'm missing something?

    Shortcut:

    Open history

    CTRL + H

    Other shortcuts: http://windows.microsoft.com/en-CA/windows-vista/Internet-Explorer-8-keyboard-shortcuts

    TaurArian [MVP] 2005-2010 - Update Services

  • "windows failed to load because the nls data is missing or corrupted"

    IM currently using vista, and when I turn on my computer
    the following message appears: "windows failed to load because the nls data is missing or corrupted"

    What does this mean message?

    that means "nls"?
    is my information on my hard drive in danger?
    How can I fix?

    Recovery discs would be Windows Vista installation files.  It would be safe to use if they are needed when the sfc/scannow scanning.

    A recovery disc is a general term for media containing a backup State initial factory or a favorable condition of a computer such as configured by an OEM manufacturer or an end user. OEM supplied recovery media is usually comes with most computers to allow the user to reformat the hard drive and reinstall the operating system and preloaded software as it was when it was shipped.

    http://en.Wikipedia.org/wiki/Recovery_disc

  • ORA-06530: Reference to the error message composite non initialized? Have I missed something

    Trying to figure out why I get message ORA-06530 to a simple example below. I am trying to create a PL/SQL table of values to be stored and then used later in a PL/SQL procedure. But now get this message when you try to added values to the table. Have I missed something?

    /*

    type of projection Usage_Groups_for_coda_tab1;

    type of projection Usage_Groups_for_coda_rec1;

    CREATE TYPE Usage_Groups_for_coda_rec1 AS

    object

    (Usage_Group_ID NUMBER (10),)

    Coda_comment VARCHAR2 (45).

    Amount NUMBER,

    Deduction_amount NUMBER)

    /

    CREATE TYPE Usage_Groups_for_coda_tab1 AS

    THE Usage_Groups_for_coda_rec1 TABLE

    /

    */

    declare

    p_usage_group_id USAGE_GROUP. USAGE_GROUP_ID % TYPE: = 10412.

    p_coda_comment CODA_TRANSACTION. CODA_TRANSACTION_COMMENT % TYPE: = 046602001;

    p_amount CODA_TRANSACTION. TOTAL_CREDIT_AMT % TYPE: = 100;

    p_deduction_amount CODA_TRANSACTION. TOTAL_CREDIT_AMT % TYPE: = 0;

    I have directory;

    g_usage_groups_for_coda_tab Usage_Groups_for_coda_tab1;

    BEGIN

    dbms_output.put_line ('initialize table');

    g_usage_groups_for_coda_tab: = Usage_Groups_for_coda_tab1();

    dbms_output.put_line ('1 added to count of records in the table");

    I: = g_usage_groups_for_coda_tab. COUNT + 1;

    dbms_output.put_line (' extend: do 1 row of table to use ');

    g_usage_groups_for_coda_tab.extend;

    dbms_output.put_line ('values added to g_usage_groups_for_coda_tab');

    g_usage_groups_for_coda_tab (i). Usage_Group_ID: = p_usage_group_id;

    g_usage_groups_for_coda_tab (i). Coda_comment: = p_coda_comment;

    g_usage_groups_for_coda_tab (i). Amount: = p_amount;

    g_usage_groups_for_coda_tab (i). Deduction_amount: = p_deduction_amount;

    dbms_output.put_line ('g_usage_groups_for_coda_tab (i).) Usage_Group_ID ' | g_usage_groups_for_coda_tab (i). Usage_Group_ID | ") ;

    END;

    You instantiate the collection, but you should also initialize the type of object for each row in the collection.

    A compact way to do this is to use the constructor when you complete each row, e... g

    g_usage_groups_for_coda_tab (i): =.

    () Usage_Groups_for_coda_rec1

    Usage_Group_ID-online p_usage_group_id,

    Coda_comment-online p_coda_comment,

    Amount-online p_amount,

    Deduction_amount-online p_deduction_amount);

  • Update of the data in the Table using XMLTYPE DATA

    I did insertions using XMLTYPE data but have never done it and update. Can someone give me some advice?

    PROCEDURE ADD_LABORDER_CODES)

    IN_ORDERCODESXML IN CLOB DEFAULT NULL,

    Number of OUT OUT_AFFECTEDROWS

    )

    AS

    X SYS. XMLTYPE;

    BEGIN

    X: = SYS. XMLTYPE. CREATEXML (IN_ORDERCODESXML);

    INSERT INTO MAINT_LABORD_CODES)

    INSERT INTO MAINT_LABORD_CODES)

    LABORD_CODE_ID,

    COMPENDIUM_ID,

    ORDER_CODE,

    ORDER_DESC,

    ACTIVE,

    TIMESTAMP,

    MODIFIED_BY)

    SELECT MLOCDS_SEQ. NEXTVAL,

    EXTRACTVALUE (VALUE (MLOC), '/ ORDERCODE/COMPENDIUM_ID') AS COMPENDIUM_ID,

    EXTRACTVALUE (VALUE (MLOC), '/ ORDERCODE/ORDER_CODE') AS ORDER_CODE,

    EXTRACTVALUE (VALUE (MLOC), '/ ORDERCODE/ORDER_DESC') AS ORDER_DESC,.

    EXTRACTVALUE (VALUE (MLOC), '/ ORDERCODE/LOINC_CODE') AS LOINC_CODE,

    EXTRACTVALUE (VALUE (MLOC), '/ ORDERCODE/ACTIVE') AS ACTIVE.

    EXTRACTVALUE (VALUE (MLOC), '/ ORDERCODE/TIMESTAMP') AS TIMESTAMP.

    EXTRACTVALUE (VALUE (MLOC), '/ ORDERCODE/MODIFIED_BY') AS MODIFIED_BY

    TABLE (XMLSEQUENCE (EXTRACT(X,'/ORDERCODES/ORDERCODE'))) NMCO;

    OUT_AFFECTEDROWS: = NUMBER OF ROWS SQL %;

    EXCEPTION

    WHILE OTHERS THEN

    dbms_output.put_line (SQLERRM);

    RAISE_APPLICATION_ERROR (-20001, SQLERRM);

    END;

    Example of use of the FUSION-

    If the line exists in the target table (based on the COMPENDIUM_ID and ORDER_CODE values), the UPDATE is, if not to INSERT:

    declare
    
      in_ordercodesxml  clob :=
      '
      
        500
        696231
        ABO Group & Rh Type
        NULL
        12345
        Y
        2014-08-13
        1
      
    ';
    
    begin
    
      merge into maint_labord_codes t
      using (
        select compendium_id
             , order_code
             , order_desc
             , loinc_code
             , active
             , timestamp
             , modified_by
        from xmltable('/ORDERCODES/ORDERCODE'
               passing xmltype(in_ordercodesxml)
               columns COMPENDIUM_ID    number(10)    path 'COMPENDIUM_ID'
                     , ORDER_CODE       varchar2(50)  path 'ORDER_CODE'
                     , ORDER_DESC       varchar2(250) path 'ORDER_DESC'
                     , LOINC_CODE       varchar2(10)  path 'LOINC_CODE'
                     , ACTIVE           varchar2(1)   path 'ACTIVE'
                     , TIMESTAMP        date          path 'TIMESTAMP'
                     , MODIFIED_BY      number(10)    path 'MODIFIED_BY'
             )
      ) x
      on (     t.compendium_id = x.compendium_id
           and t.order_code = x.order_code )
      when matched then update
        set t.order_desc = x.order_desc
          , t.loinc_code = x.loinc_code
          , t.active     = x.active
          , t.timestamp  = x.timestamp
          , t.modified_by = x.modified_by
      when not matched then insert
      (
        labord_code_id
      , compendium_id
      , order_code
      , order_desc
      , loinc_code
      , active
      , timestamp
      , modified_by
      )
      values (
        mlocds_seq.nextval
      , x.compendium_id
      , x.order_code
      , x.order_desc
      , x.loinc_code
      , x.active
      , x.timestamp
      , x.modified_by
      );
    
    end;
    /
    

    Also note that I used XMLTABLE instead of TABLE/XMLSEQUENCE, which is much easier to use (and not deprecated in the latest versions).

    You have not precisely the date format in the TIMESTAMP element so I assumed a conform to W3C.

    If you have a problem with this part, return to a projection of VARCHAR2 and use TO_DATE with actual size.

  • BufferedReader InputStream?  I'm missing something...

    Video lesson 3-4 deals with "Method 2" to get a BufferedReader using an InputStream created from UART.

    The minute 04:38 mark slideshows:

    InputStream is = Channels.newInputStream (uart);

    BufferedReader reader = new BufferedReader (is);

    The IDE nor any JavaDoc I find this a constructor for a BufferedReader with an InputStream as an argument.

    Just curious to know if I'm missing something or there is an error?

    It should be: Player BufferedReader in = new BufferedReader (new InputStreamReader (is));

    Thank you


    Brent S

    As a result of my own question, I've implemented as follows, and it does not work (good or bad).

    InputStream is = Channels.newInputStream (uart);

    BufferedReader reader = new BufferedReader (new InputStreamReader (is));

    Maybe a quick edit of the video he will make it clear if I'm right.

    Enjoy!

    Brent S

  • I have Photoshop CC... but it lacks the corrector, the task Healing Brush tool and the dodge tool and burn... am I missing something

    I have Photoshop CC, it is fairly new for... but me it is missing the Healing Brush, spot corrector tool tool and the tool dodge and burn... I missed something

    left Adobe Creative Cloud for Photoshop for beginners

  • I've just updated Adobe Professional, but I'm not able to add, to delete the pages more. Before the update, it wasn't a problem. I missed something?

    I've just updated Adobe Professional, but I'm not able to add, to delete the pages more. Before the update, it wasn't a problem. I missed something?

    Are you sure that you're not open your files with the free player instead of using Acrobat? And please do not post the same question multiple times. Also, try to be more specific. "I am not able" can mean many different things.

Maybe you are looking for

  • iCloud complete storage

    There is NO photos or videos stored on my iCloud.  No contacts.  No notes.  (Essentially) nothing.  Yet, he tells me that it is almost full (see screen capture).  What Miss me?  If I'm still not using the space to store the essential elements (photos

  • How to detect in your code what sensors/actuators are connected to your EV3

    I want to detect what sensors/actuators connected to the ports in my brick EV3. I would like to do if possible labvew, or using the lego mindstorms software.

  • HP ENVY 15 t-k200 CT: HP ENVY - 15 t-k200 CTO gel touchpad?

    Hi all! I just got my my new laptop, a HP ENVY 15t k200 CTO Tuesday and I have noticed sometimes the touchpad seems to freeze randomly for a few seconds. Normally if I touch once again, once or twice, it will release. Now, I'm not entirely sure what'

  • Visa resource unavailable, device to use my other program

    Hey guys,.I bought a Usb to parallel Port adapter and created a pilot nor Visa for him and then launch labview and I ran some programs on the card and everything worked, I was able to send data to the usb port and able to light a led and turn off...

  • Printing of A4 e-all-in-one printer, HP Photosmart 5520

    Hello I try to print in A4 format, but my 5520 does not have this facility. Any help would be welcome. I don't see what I'm doing wrong, I have changed to plain paper but still do not see an option A4. Thank you