SQL or PL/SQL-> check a grouping of several criteria in the same group.

Hello

Oracle 11g. I need to check a set of data for multiple filtering criteria together. If the criterion is found, the FLAG_SET is updated.

The example data:
MEMBER     |     GROUPING             |     CODES     |     ROW_NUMBER     |     FLAG_SET
001          |     1               |     A          |     45               |     0
001          |     1               |     B          |     48               |     0
002          |     1               |     C          |     45               |     0
002          |     1               |     C          |     49               |     0
002          |     1               |     A          |     52               |     0
002          |     2               |     A          |     43               |     0
002          |     2               |     B          |     62               |     0
002          |     2               |     B          |     63               |     0
003          |     1               |     A          |     72               |     0
003          |     1               |     B          |     76               |     0
My requirement is to test if a MEMBER within a GROUPING has an 'A' and 'B' (although there are several criteria to test on for example.) "C" and had "and they are prioritized. I would test a game both in a called proc).

I need the following output:
MEMBER     |     GROUPING             |     CODES     |     ROW_NUMBER     |     FLAG_SET
001          |     1               |     A          |     45               |     1
001          |     1               |     B          |     48               |     1
002          |     1               |     C          |     45               |     0
002          |     1               |     C          |     49               |     0
002          |     1               |     A          |     52               |     0
002          |     2               |     A          |     43               |     1
002          |     2               |     B          |     62               |     1
002          |     2               |     B          |     63               |     1
003          |     1               |     A          |     72               |     0
003          |     1               |     C          |     76               |     0
I can't just update the indicators if a single 'A' CODE is found. He must have the 'A' and 'B '.
I tried several ways, most recently LISTAGG put all grouped values of each line and the string for CODE analysis, I lose the ROW_NUMBER when this happens but it cannot be part of the coiled LISTAGG.

Someone at - it ideas?

Published by: chris001 on November 28, 2012 13:33

Hello

You can do it with a MERGE, something like statement:

MERGE INTO table_x     dst
USING   (
         SELECT    mmbr     -- MEMBER is an Oracle keyword
         ,           grpng     -- GROUPING is an Oracle keyword, too
         ,           CASE
                        WHEN  COUNT ( DISTINCT CASE
                                              WHEN codes IN ('A', 'B')
                                   THEN codes
                                  END
                          ) = 2
                 THEN  1
          --       WHEN  ...
          --       THEN  2
          --       WHEN  ...
                 ELSE  0
                    END
         FROM      table_x
         GROUP BY  mmbr
         ,           grping
     )          src
ON     (   src.mmbr       = dst.mmbr
     AND src.grpng       = dst.grpng
     )
WHEN MATCHED THEN UPDATE
SET     dst.flag_set     = src.flag_set
WHERE     dst.flag_set   != src.flag_set
;

According to your needs.
If you would care to post CREATE TABLE and INSERT to your sample data (as it exists before the changes), then I could test this.

You have not need PL/SQL for this, but, if you need to do it in PL/SQL for some reason, you can.

I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
If you ask on a DML statement, such as UPDATE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or the tables changed when it's all over.
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002}

Published by: Frank Kulash on November 28, 2012 16:53

Tags: Database

Similar Questions

  • Developer SQL is no longer let me look at the same table on 2 servers name

    I used to be able to look at the same table (such as; "ATS_Reminders") on my development box and my box of production at the same time. Now when I connect the two databases, if I try to open the table even on the second square, the first table closed so I can't watch side by side. Is there a way to fix this annoying problem?

    I am on Windows 7 running:

    Java (TM) Platform 1.6.0_11
    Oracle IDE 3.1.07.42
    Support versioning 3.1.07.42

    Hi bucketofsquid.

    You need to pin the 1st Editor. This can be done manually by clicking on the view button to freeze on the toolbar of the object viewer or automatically by setting auto freeze on in the preferences. Tools-> preferences-> database-> ObjectViewer-> automatically freeze object viewer Windows

    Brian Jeffries
    SQL development team

  • Stuck on a sql query to search for records that have the same parent child records

    Oracle 10 g 2 Enterprise Edition.

    Hello

    I'm writing a logic to find records in a parent table, who have the same values in a child table.
    This is part of a larger application, but I am stuck on that part for now, so I have mocked some of the below simplified tables to capture the heart of the
    the problem is that I'm stuck.
    Let's say I have a responsible parent, child employee table table and there are a number of many relationships between them.
    The aptly named Join_Table manages the relationship between them. If a manager can manage several employees, an employee can be managed by
    many managers.

    I have a feeling it's stupidly easy, but it seems to me having a bad episode of brain freeze today!
    -- parent table
    CREATE TABLE manager (
     id      number primary key,
     name      varchar2(100));
    
    -- child table 
    CREATE TABLE employee (
     id          number primary key,
     name      varchar2(100));
    
    -- link table
    CREATE TABLE join_table (
     manager_id          NUMBER, 
     employee_id      NUMBER,
     CONSTRAINT join_table_pk PRIMARY KEY (manager_id, employee_id),
     CONSTRAINT manager_fk FOREIGN KEY (manager_id) REFERENCES manager(id),
     CONSTRAINT employee_fk FOREIGN KEY (employee_id) REFERENCES employee(id) 
     );
    
    -- Insert some managers
    INSERT INTO manager (id, name) VALUES (1, 'John');
    INSERT INTO manager (id, name) VALUES (2, 'Bob');
    INSERT INTO manager (id, name) VALUES (3, 'Mary');
    INSERT INTO manager (id, name) VALUES (4, 'Sue');
    INSERT INTO manager (id, name) VALUES (5, 'Alan');
    INSERT INTO manager (id, name) VALUES (6, 'Mike');
    
    -- Insert some employees 
    INSERT INTO employee (id, name) VALUES (101, 'Paul');
    INSERT INTO employee (id, name) VALUES (102, 'Simon');
    INSERT INTO employee (id, name) VALUES (103, 'Ken');
    INSERT INTO employee (id, name) VALUES (104, 'Kevin');
    INSERT INTO employee (id, name) VALUES (105, 'Jack');
    INSERT INTO employee (id, name) VALUES (106, 'Jennifer');
    INSERT INTO employee (id, name) VALUES (107, 'Tim');
    
    -- Insert the links
    -- John manages Paul, Simon, Ken
    INSERT INTO join_table (manager_id, employee_id) VALUES (1, 101);
    INSERT INTO join_table (manager_id, employee_id) VALUES (1, 102);
    INSERT INTO join_table (manager_id, employee_id) VALUES (1, 103);
    -- Bob manages Paul, Simon, Kevin, Jack
    INSERT INTO join_table (manager_id, employee_id) VALUES (2, 101);
    INSERT INTO join_table (manager_id, employee_id) VALUES (2, 102);
    INSERT INTO join_table (manager_id, employee_id) VALUES (2, 104);
    INSERT INTO join_table (manager_id, employee_id) VALUES (2, 105);
    -- Mary manages Jennifer, Tim
    INSERT INTO join_table (manager_id, employee_id) VALUES (3, 106);
    INSERT INTO join_table (manager_id, employee_id) VALUES (3, 107);
    -- Sue manages Jennifer, Tim
    INSERT INTO join_table (manager_id, employee_id) VALUES (4, 106);
    INSERT INTO join_table (manager_id, employee_id) VALUES (4, 107);
    -- Alan manages Paul, Simon, Ken, Jennifer, Tim
    INSERT INTO join_table (manager_id, employee_id) VALUES (5, 101);
    INSERT INTO join_table (manager_id, employee_id) VALUES (5, 102);
    INSERT INTO join_table (manager_id, employee_id) VALUES (5, 103);
    INSERT INTO join_table (manager_id, employee_id) VALUES (5, 106);
    INSERT INTO join_table (manager_id, employee_id) VALUES (5, 107);
    -- Mike manages Paul, Simon, Ken
    INSERT INTO join_table (manager_id, employee_id) VALUES (6, 101);
    INSERT INTO join_table (manager_id, employee_id) VALUES (6, 102);
    INSERT INTO join_table (manager_id, employee_id) VALUES (6, 103);
    
    -- For sanity
    CREATE UNIQUE INDEX employee_name_uidx ON employee(name);
    If I ask for Manager John, so I want to find other managers who manage the exact list and even employees.
    Answer should be Mike.
    If I ask for Manager of Mary, the answer should be Sue.

    This query will give me the list of managers who manage some of the same employees as John, but not the same employees accurate...
    SELECT DISTINCT m.name AS manager
    FROM manager m, join_table jt, employee e
    WHERE m.id = jt.manager_id
    AND jt.employee_id = e.id
    AND e.id IN (
         SELECT e.id
         FROM manager m, join_table jt, employee e
         WHERE m.id = jt.manager_id
         AND jt.employee_id = e.id
         AND m.name = 'John')
    ORDER BY 1;
    I thought about using set operations to find managers with a list of employees less than my employees is null and where my employees under their list of employees is null. But there must be an easier way more elegant.
    Any ideas?
    BTW, I need to run as a batch on tables with > 20 million rows so the efficiency of queries is key.

    What about...

    WITH manager_list AS
    (
     SELECT name,
            LTRIM(MAX(SYS_CONNECT_BY_PATH(id,','))
            KEEP (DENSE_RANK LAST ORDER BY curr),',') AS employees
     FROM   (SELECT m.name,
                    e.id,
                    ROW_NUMBER() OVER (PARTITION BY m.name ORDER BY e.id) AS curr,
                    ROW_NUMBER() OVER (PARTITION BY m.name ORDER BY e.id) -1 AS prev
             FROM   manager m,
                    join_table jt,
                    employee e
      WHERE m.id           = jt.manager_id
      AND   jt.employee_id = e.id
      AND   m.name = :P_MANAGER)
      GROUP BY name
      CONNECT BY prev = PRIOR curr AND name = PRIOR name
      START WITH curr = 1
    ), all_list AS
    (
     SELECT name,
            LTRIM(MAX(SYS_CONNECT_BY_PATH(id,','))
            KEEP (DENSE_RANK LAST ORDER BY curr),',') AS employees
     FROM   (SELECT m.name,
                    e.id,
                    ROW_NUMBER() OVER (PARTITION BY m.name ORDER BY e.id) AS curr,
                    ROW_NUMBER() OVER (PARTITION BY m.name ORDER BY e.id) -1 AS prev
             FROM   manager m,
                    join_table jt,
                    employee e
      WHERE m.id           = jt.manager_id
      AND   jt.employee_id = e.id)
      GROUP BY name
      CONNECT BY prev = PRIOR curr AND name = PRIOR name
      START WITH curr = 1
    )
    SELECT a.*
    FROM   manager_list m,
           all_list a
    WHERE  m.employees = a.employees
    

    Would be easier in 11g, but I do not have a facility here so this is based on 10g.

    See you soon

    Ben

  • PowerCLi script to check if 2 virtual machines are on the same host

    Hello

    I'm nubby on PowerCLI and I would like to help in the construction of a script.

    The script should check if two virtual machines (named test1 and test2) are running on the same host in a vCenter and send a notification (email), if they do.

    Something similar with affinity / anti-affinite DRS rules (but not through the DRS enabled on vCenter).  My focus is on the affinity. In case this happens, I need vMotion one of them on an another ESXi host(manually or automated).

    What I have done until now is the following:

    Get - VM | Select Name, @{N = 'Cluster'; {E = {Get-Cluster - VM $_}}, '

    @{N = "ESX host"; {E = {Get-VMHost - VM $_}}, '

    @{N = 'vCenter'; E={$_. "(ExtensionData.CLient.ServiceUrl.Split('/') [2]}}, '"

    @{N = "Datastore"; {E = {Get-Datastore - VM $_}} | `

    Export-Csv - NoTypeInformation C:\Scripts\file.csv

    That becomes all the VMS and export a CSV file information:

    NameClusterESX hostvCenterData store
    test2cluster_testESXi_test1vCenter_test1:443datastore1
    Test1cluster_testESXi_test1vCenter_test1:443datastore1
    For1.localcluster_testESXi_test1vCenter_test1:443datastore1
    VM1.localcluster_test2ESXi_test2vCenter_test1:443datastore1
    VM2.localcluster_test3ESXi_test3vCenter_test1:443datastore1
    VM31.localcluster_test3ESXi_test3vCenter_test1:443datastore1

    Thank you.

    Try like this.

    $tgtVM = "test1", "test2".

    Get-VM-name $tgtVM | Group-object - property VMHost | %{

    if($_.) County - gt 1) {}

    $vm = $_. Group | Get-Random

    $esx = $vm. VMHost

    $tgtEsx = get-Cluster - $vm VM | Get-VMHost | where {$_.} Name - not $esx. Name} | Get-Random

    Move-VM - $vm - Destination $tgtEsx VM - confirm: $false

    }

    }

  • How to delete several items at the same time. need to highlight or check multiple items? I am referring to the Tablet Surface.

    I would like to empty deleted and unwanted records. Is there a way to select all!

    I do not know how to select everything, but you can scan slightly with your finger from left to right in each email that you want to remove, each in turn will be darker and get a check mark. Select the delete icon in the upper right and remove all these selected emails.

  • Manipulation of several ID - several departments of the same company group

    http://www.b2bgurus.com/2008/07/handling-multiple-group-ID-multiple.html

    In step 4, it is mentioned that we needed to create a single agreement. Can we establish an agreement for each department or creating an agreement for any Department automatically will process documents for the two departments?

    Create a single agreement. Be sure to turn off validation.

    Another way of activation of this feature is to use the following tip.property.

    Oracle.Tip.adapter.B2B.EDI.ignoreValidation =

    Provide these ID which will be different from the one configured. Few of the identifiers in the sample are:
    InterchangeReceiverID, InterchangeSenderID, GroupReceiverID, GroupSenderID, GroupSenderQual, GroupReceiverQual, InterchangeSenderQual, InterchangeReceiverQual

  • in Outlook Express, how can I send the same message to a group important (in the address book already), but have to each recipient can only see his name (not the Group)

    In Outlook Express, how can I send the same message to the large group (already in the address book), but have to each recipient can only see his name (not the Group)?

    To use the functionality of the BCC (Blind Carbon Copy), in a new message window, click View | All headers and type the addresses separated by a; Or: Click the button to. You will see your list of contacts and the choice to put them in the To, CC, or BCC field. Click on an address, and then click BCC to add it. Repeat for all of the contacts you want. (Note: most of the providers have limits as to how many messages you can send both a. 25 is common, but it varies).

    Put your own address in the box to. That's the only name/address that any recipient will see. If you leave the field empty, some people may not receive e-mail because of message rules they put in place, or restrictions imposed by their ISP.

    You can also make an entry in the address book using your e-mail address, but put something like the mailing list in the area of the display.

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

    You can also create groups if you send e-mail to the same people often.

    To create a group of contacts:

    You can create a single group name (or alias) to use when sending a message to several contacts at the same time. Just create a group name and add individual contacts to the group. Then just type the name of the group in the box for when you send mail.

    1. in the address book, select the folder in which you want to create a group. Click New in the toolbar, and then click New Group.
    2. the Properties dialog box opens. In the group name box, type the name of the group.
    3. There are several ways to add people to the Group:
    a. to add a person from your address book list, click Select members, and then click a name in the address book list.
    (b) to add a person directly to the group without adding the name to your address book, type the person's name and e-mail address at the bottom of the Properties dialog box and then click Add.
    to add a person to both the Group and your address book, click New Contact and enter the appropriate information.
    (d) to use a directory service, click Select members, and then click search. Select a directory service in the drop-down list at the end of the text box. After finding and selecting an address, it is automatically added to your address book.
    4. Repeat for each addition until your group is defined.

    Note

    a. to view a list of your groups separately from the list of address book in the address book on the view menu, make sure that folders and groups is selected.
     
    b. you can create multiple groups, and contacts can belong to several groups.

    If you want to send to a group without addresses are displayed for each recipient, open the address book and make a new entry. Enter the name of the group in the area of the display, but use your address. (Some Internet service providers require a legitimate address in the line to and recipients will know it's from the Group).

    Click on the button to. Enter the name of the group using your address. Enter the group in the BCC field.

  • PL/SQL: ORA-00934: Group feature is not allowed here

    Hello

    I write a PL/SQL procedure. The structure is like:

    SET SERVEROUTPUT ON;
    CREATE or REPLACE procedure abc

    IS
    v_total_ip_rec number (14);
    v_total_op_rec number (14);
    v_total_rec number (14);


    BEGIN
    SELECT SUM (CASE
    WHEN < condition 1 >
    THEN 1
    0 OTHERWISE
    END
    ) in v_total_ip_rec.
    SUM (CASE
    WHEN < condition 2 >
    THEN 1
    0 OTHERWISE
    END
    ) in v_total_op_rec.
    SUM (1) in v_total_rec
    OF A, B
    WHERE A.Col1 = B.Col1;

    EXCEPTION
    WHILE OTHERS THEN
    raise_application_error (-20001,' an error has occurred - ' |) SQLCODE |' - ERROR - ' | SQLERRM);
    END;


    When I run this procedure it gives me following error:
    "PL/SQL: ORA-00934: Group feature is not allowed here."

    Someone has an idea?

    Any help would be appreciated.

    Thank you.

    Should I have any special role?

    Have you checked if synonyms exist for tables?
    Please check in this order:

    #1-synonymes appropriate
    #2-appropriate privileges
    #3-appropriate roles

  • Extraction of extensible in PL/SQL SOAP envelope group

    Hi all.

    I have the following in an XMLTYPE variable in PL/SQL SOAP envelope.

    <? XML version = "1.0" encoding = "UTF - 8"? >
    < env:Envelope xmlns:env = "http://schemas.xmlsoap.org/soap/envelope/" container = "http://www.w3.org/2001/XMLSchema" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0 = "http://elmarwsoicdvmws/types/" >
    < env:Body >
    < ns0:getDVMValuesResponseElement >
    < ns0:result >
    < ns0:dvmValues > 10 < / ns0:dvmValues >
    < ns0:dvmValues > 11 < / ns0:dvmValues >
    < ns0:dvmValues > 12 < / ns0:dvmValues >
    < ns0:errorText > Ok < / ns0:errorText >
    < ns0:errorCode > 0 < / ns0:errorCode >
    < / ns0:result >
    < / ns0:getDVMValuesResponseElement >
    < / env:Body >
    < / env:Envelope > '

    I can extract the code of error and ErrorText variable without too much effort (even if I don't know there are easier ways), but now I have to extract the repeating group of dvmValues in a variable of type table.

    Any ideas/code snippets would be greatly appreciated, as I've read tons of docs and half the time they are too complex or too simplistic (given my ns0: variables), and it seems that many functions I use have been depricated.

    Kind regards

    Elmar

    Hi Elmar,

    Using a separate function to analyze the individual nodes is not necessary.
    You can extract all with a single query, thus eliminating the need to access the same document several times.

    For example, once you have the content in the RESP xmltype variable, you can do:

    SQL> create type dvmValues_t as table of number;
      2  /
    
    Type created
    
    SQL> set serveroutput on
    SQL>
    SQL> DECLARE
      2
      3    resp         xmltype;
      4    v_errorText  varchar2(2000);
      5    v_errorCode  number;
      6    v_dvmValues  dvmValues_t;
      7
      8  BEGIN
      9
     10    resp := xmltype('
     11  
     12  
     13  
     14  
     15  10
     16  11
     17  12
     18  Ok
     19  0
     20  
     21  
     22  
     23  ');
     24
     25    select x.errorText
     26         , x.errorCode
     27         , cast(
     28             multiset(
     29               select dvmValue
     30               from xmltable('*' passing x.dvmValues
     31                                 columns dvmValue number path '.')
     32             )
     33             as dvmValues_t
     34           )
     35    into v_errorText
     36       , v_errorCode
     37       , v_dvmValues
     38    from xmltable(
     39           xmlnamespaces(
     40             'http://schemas.xmlsoap.org/soap/envelope/' as "env"
     41           , default 'http://elmarwsoicdvmws/types/'
     42           )
     43         , '/env:Envelope/env:Body/getDVMValuesResponseElement/result'
     44           passing resp
     45           columns
     46             errorText  varchar2(2000)  path 'errorText'
     47           , errorCode  number          path 'errorCode'
     48           , dvmValues  xmltype         path 'dvmValues'
     49         ) x
     50    ;
     51
     52    dbms_output.put_line('Error Text = ' || v_errorText);
     53    dbms_output.put_line('Error Code = ' || v_errorCode);
     54
     55    for i in 1..v_dvmValues.count loop
     56      dbms_output.put_line('Value(' || to_char(i) || ') = ' || v_dvmValues(i));
     57    end loop;
     58
     59  END;
     60  /
    
    Error Text = Ok
    Error Code = 0
    Value(1) = 10
    Value(2) = 11
    Value(3) = 12
    
    PL/SQL procedure successfully completed
     
    
  • SQL count (*) with Group of

    Hello

    I need help to fix this SQL.

    Fields in the table are like that.
    ID(PK)
    user_id
    user_name
    login_time(timestamp)
    Basically I want the values of user_id, user_name, last time the logged-in user and total number of times the user
    select  distinct user_id , user_name, login_date from USER_LOGIN
    where login_date in (select max(login_date) from USER_LOGIN group by user_id) 
    the above query is to give the result set with user_id, user_name, last time that the user logged on, but how can I include count (*) Group of user_id in the sql above
    select  distinct user_id , user_name, login_date, count(*) from USER_LOGIN
    where login_date in (select max(login_date) from USER_LOGIN group by user_id)  group by user_id 
    the sql above does not work.

    can you help me to get the number of records by user_id group.

    Thank you
    SK

    Hello

    Looks like you want something like this:

    SELECT       user_id
    ,       user_name
    ,       MAX (login_time)     AS last_login_time
    ,       COUNT (*)          AS total_rows
    FROM       user_login
    GROUP BY  user_id
    ,            user_name
    ;
    

    This assumes that user_login is off standard (like him are often seen), such that every row of the same user_id will also have the same user_name.

    I hope that this answers your question.
    If not, post a small example of data (CREATE TABLE and INSERT statements) and the results desired from these data.

  • Need help with query SQL Inline views + Group

    Hello gurus,

    I would really appreciate your time and effort on this application. I have the following data set.

    Reference_No---Check_Number---Check_Date---description---Invoice_Number---Invoice_Type---Paid_Amount---Vendor_Number
    1234567 11223 - 05/07/2008 -paid for cleaning- 44345563-I-* 20.00 *---19
    1234567 11223 - 05/07/2008 - 44345563 -a--10,00---19 ofbad quality adjustment
    7654321 11223 - 05/07/2008 - setting the last billing cycle - 23543556 - A - 50.00 - 19
    4653456 11223 - 05/07/2008 - paid for cleaning - 35654765 - I - 30, 00-19

    Please ignore '-' added for clarity

    I'm writing a paid_amount based on Reference_No, Check_Number, Payment_Date, Invoice_Number, aggregate query Invoice_Type, Vendor_Number and display description with Invoice_type 'I' when there are multiple records with the same Reference_No, Check_Number, Payment_Date, Invoice_Type, Invoice_Number, Vendor_Number. When there are no more records I want to display the respective Description.

    The query should return the following data set

    Reference_No---Check_Number---Check_Date---description---Invoice_Number---Invoice_Type---Paid_Amount---Vendor_Number
    1234567 11223 - 05/07/2008 -paid for cleaning- 44345563-I-* 10.00 *---19
    7654321 11223 - 05/07/2008 - setting the last billing cycle - 23543556 - A - 50.00 - 19
    4653456 11223 - 05/07/2008 - paid for cleaning - 35654765 - I - 30, 00-19
    Here's my query. I'm a little lost.

    Select b., A.sequence_id, A.check_date, A.check_number, A.invoice_number, A.amount, A.vendor_number
    de)
    Select sequence_id, check_number, check_date, invoice_number, sum (paid_amount) sum, vendor_number
    of the INVOICE
    Sequence_id group check_date, check_number, invoice_number, vendor_number
    ) A, B OF INVOICE
    where A.sequence_id = B.sequence_id


    Thank you
    Nick

    It seems that this is a duplicate thread - correct me if I am wrong in this case->

    Need help with query SQL Inline views + Group

    Kind regards.

    LOULOU.

  • Service SQL Server 2014 will not start start after the update sp1 (KB3058865, KB3075950, KB3094221)

    Hi, my SQL Server 2014 works very well in my server with WIndows 2012 until I installed the new day & service pack that was required for server hardening.

    I successfully installed SP1 KB 3058865 first, then discovered that the services do not start. After so much research to fix, I came with the 2 cu updates KB3075950, KB3094221 in knowing that it could solve my problem but unfortunately is not.

    I also tried to change the service account that many suggest, but his does not work.

    I tried to replace the master file & maslog but also failed.

    I tried to run etc and unique usermode and restore master db... also failed.

    Here is the log file:

    16/02/01 15:21:21.83 Server Microsoft SQL Server 2014 (SP1 - CU3) (KB3094221) - 12.0.4427.24 (X 64)
    October 10, 2015 17:18:26
    Copyright (c) Microsoft Corporation
    Standard Edition (64-bit) on Windows NT 6.2 (build 9200 :) (hypervisor)

    2016-02-01 15:21:21.84 setting the server UTC: 08:00
    2016-02-01 15:21:21.84 Server (c) Microsoft Corporation.
    2016-02-01 15:21:21.84 server all rights reserved.
    2016-02-01 15:21:21.84 server process ID is 5128.
    2016-02-01 15:21:21.86 Server system manufacturer: "Microsoft Corporation", model of system: 'Virtual Machine '.
    2016-02-01 15:21:21.86 the server's authentication mode is MIXED.
    2016-02-01 15:21:21.86 Server record SQL Server messages in file ' C:\Program Files\Microsoft SQL Server\MSSQL12. MSSQLSERVER\MSSQL\Log\ERRORLOG'.
    2016-02-01 15:21:21.86 Server service account is "NT Service\MSSQLSERVER". This is an informational message; no user action is required.
    2016-02-01 15:21:21.86 registry server startup parameters:
    -d C:\Program Files\Microsoft SQL Server\MSSQL12. MSSQLSERVER\MSSQL\DATA\master.mdf
    e C:\Program Files\Microsoft SQL Server\MSSQL12. MSSQLSERVER\MSSQL\Log\ERRORLOG
    l C:\Program Files\Microsoft SQL Server\MSSQL12. MSSQLSERVER\MSSQL\DATA\mastlog.ldf
    2016-02-01 15:21:21.86 Server startup command line parameters:
    s 'MSSQLSERVER '.
    2016-02-01 15:21:22.27 Server SQL Server has detected 1 struggling with 1 cores per socket and 1 logical processors per socket, 1 total logical processors; using 1 logical processors based on SQL Server licenses. This is an informational message; no user action is required.
    2016-02-01 15:21:22.27 Server SQL Server starts at the normal base priority (= 7). It is an informational message only. No user action is required.
    2016-02-01 15:21:22.28 Server has detected 7999 MB of RAM. This is an informational message; no user action is required.
    2016-02-01 15:21:22.28 Server using conventional memory in the memory manager.
    2016-02-01 15:21:22.33 default server collation: SQL_Latin1_General_CP1_CI_AS (us_english 1033)
    2016-02-01 15:21:22.37 Server this instance of SQL Server is a latest report by using a process ID of 1600 at 01/02/2016 15:13:12 (local) 01/02/2016 07:13:12 (UTC). This is an informational message only; no user action is required.
    2016-02-01 15:21:22.38 the maximum number of connections administrator dedicated to this server instance is '1 '.
    2016-02-01 15:21:22.38 configuration of server node: node 0: CPU mask: 0 x 0000000000000001:0 Active CPU mask: 0 x 0000000000000001:0. This message provides a description of the NUMA configuration for this computer. It is an informational message only. No user action is required.
    2016-02-01 15:21:22.40 allocation of dynamic locking using the server.  Initial allocation of blocks of lock of 2500 and 5000 per node lock owner.  It is an informational message only.  No user action is required.
    2016-02-01 15:21:22.43 spid8s start database 'master '.
    2016-02-01 15:21:22.49 Server CLR version loaded v4.0.30319.
    2016-02-01 15:21:22.51 spid8s d - 8 operations in the database 'master' (1:0). It is an informational message only. No user action is required.
    2016-02-01 15:21:22.61 Server common language features (CLR) runtime initialized using CLR version C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ v4.0.30319.
    2016-02-01 15:21:22.62 spid8s 0 operations cancelled in database 'master' (1:0). It is an informational message only. No user action is required.
    2016-02-01 15:21:22.62 spid8s Recovery is writing a checkpoint in database 'master ' (1). It is an informational message only. No user action is required.
    2016-02-01 15:21:22.79 spid8s SQL Server Audit begins audits. This is an informational message. No user action is required.
    2016-02-01 15:21:22.80 spid8s SQL Server Audit has begun audits. This is an informational message. No user action is required.
    2016-02-01 15:21:22.88 spid8s Trace SQL ID 1 was launched by the "sa" login
    2016-02-01 15:21:23.28 spid8s server name is "UATCASADB". It is an informational message only. No user action is required.
    2016-02-01 15:21:23.28 spid13s A self-generated certificate was loaded successfully for encryption.
    2016-02-01 15:21:23.33 spid13s Server listens on ['none' 1433].
    2016-02-01 15:21:23.40 spid13s Server listens on ['none' 1433].
    local connections provider 2016-02-01 15:21:23.44 spid13s server is ready to accept connection on [\\.\pipe\SQLLocal\MSSQLSERVER].
    local connections provider 2016-02-01 15:21:23.44 spid13s server is ready to accept connection on [\\.\pipe\sql\query].
    2016-02-01 15:21:23.48 Server Server listens on [: 1 1434].
    2016-02-01 15:21:23.49 Server Server listening on [127.0.0.1 1434 ].
    2016-02-01 15:21:23.49 connection admin support dedicated server was created for locally listening on port 1434.
    2016-02-01 15:21:23.49 Server SQL Server attempts to save an of Service Principal name (SPN, service principal name) for the SQL Server service. Kerberos authentication is not possible, until a name for the SQL Server service is SPN. This is an informational message. No user action is required.
    2016-02-01 15:21:23.60 spid14s A new instance of the full-text filter daemon host process has been started successfully.
    2016-02-01 15:21:23.71 Server SQL Server Network Interface library successfully registered the Service Principal Name (SPN) [MSSQLSvc/UATCASADB.onenetworkbank.com.ph] for the SQL Server service.
    2016-02-01 15:21:23.72 Server SQL Server Network Interface library successfully registered the Service Principal Name (SPN) [MSSQLSvc/UATCASADB.onenetworkbank.com.ph:1433] for the SQL Server service.
    2016-02-01 15:21:23.97 spid17s start database 'msdb '.
    2016-02-01 15:21:23.98 spid18s database startup "ReportServer".
    2016-02-01 15:21:23.98 spid19s database startup 'ReportServerTempDB '.
    2016-02-01 15:21:24.03 spid9s start database 'mssqlsystemresource '.
    2016-02-01 15:21:24.08 spid9s the base resource database build version is 12.00.4427. It is an informational message only. No user action is required.
    Error logon 2016-02-01 15:21:24.11: 18401, severity: 14, State: 1.
    2016-02-01 15:21:24.11 of logon login failed for user "NT SERVICE\ReportServer". Reason: The server is in script upgrade mode. Only one administrator can connect at this time. [CLIENT: ]
    2016-02-01 15:21:24.18 spid19s 1 transactions rolled forward in the 'ReportServerTempDB' (6:0) database. It is an informational message only. No user action is required.
    2016-02-01 15:21:24.28 spid19s 0 transactions cancelled in the database 'ReportServerTempDB' (6:0). It is an informational message only. No user action is required.
    2016-02-01 15:21:24.44 spid17s 133 transactions rolled forward in the database 'msdb' (4:0). It is an informational message only. No user action is required.
    2016-02-01 15:21:24.73 spid17s 0 transactions cancelled in the database 'msdb' (4:0). It is an informational message only. No user action is required.
    2016-02-01 15:21:24.74 spid17s Recovery is writing a checkpoint in database 'msdb' (4). It is an informational message only. No user action is required.
    2016-02-01 15:21:24.79 spid9s start database 'model '.
    2016-02-01 15:21:25.01 spid9s clearing tempdb database.

    2016-02-01 15:21:25.94 spid9s start database 'tempdb '.
    2016-02-01 15:21:26.12 spid20s The Service Broker endpoint is in a disabled or stopped state.
    2016-02-01 15:21:26.12 spid20s The Database Mirroring endpoint is disabled or stopped state.
    Manager of Service Broker 2016-02-01 15:21:26.15 spid20s began.
    2016-02-01 15:21:27.32 spid8s database 'master' is upgrading script 'msdb110_upgrade.sql' of level 201328592 level 201331019.
    2016-02-01 15:21:27.32 spid8s-
    2016-02-01 15:21:27.32 spid8s start PRE_MSDB execution. SQL
    2016-02-01 15:21:27.32 spid8s-
    2016-02-01 15:21:28.36 spid8s configuration database COMPATIBILITY_LEVEL option for 100 for database 'msdb '.
    2016-02-01 15:21:28.56 spid8s-
    2016-02-01 15:21:28.56 spid8s start PRE_SQLAGENT100 execution. SQL
    2016-02-01 15:21:28.56 spid8s-
    2016-02-01 15:21:28.60 spid8s configuration database option COMPATIBILITY_LEVEL of 120 for the database 'msdb '.
    2016-02-01 15:21:28.77 spid8s Configuration option 'allow updates' goes from 1 to 1. Run the RECONFIGURE statement to install.
    2016-02-01 15:21:28.77 spid8s Configuration option 'allow updates' goes from 1 to 1. Run the RECONFIGURE statement to install.
    Error logon 2016-02-01 15:21:29.18: 18401, severity: 14, State: 1.
    2016-02-01 15:21:29.18 of logon login failed for user "NT SERVICE\ReportServer". Reason: The server is in script upgrade mode. Only one administrator can connect at this time. [CLIENT: ]
    2016-02-01 15:21:31.84 spid8s attempting to load library 'xpstar.dll' in memory. It is an informational message only. No user action is required.
    "2016-02-01 by using spid8s 15:21:31.86"xpstar.dll' version ' 2014.120.4100 ' to run the extended stored procedure 'xp_instance_regread '. This is an informational message only; no user action is required.
    2016-02-01 15:21:31.89 spid8s DBCC TRACEOFF 1717, process server ID (SPID) 8. This is an informational message only; no user action is required.
    2016-02-01 15:21:31.89 spid8s DBCC execution completed. If DBCC printed in error messages, contact your system administrator.
    2016-02-01 15:21:31.90 spid8s
    2016-02-01 15:21:31.90 spid8s create table temp_sysjobschedules
    2016-02-01 15:21:32.20 spid8s
    2016-02-01 15:21:32.20 spid8s Alter table sysdownloadlist...
    2016-02-01 15:21:32.22 spid8s
    2016-02-01 15:21:32.22 spid8s Alter table sysjobhistory...
    2016-02-01 15:21:32.24 spid8s
    2016-02-01 15:21:32.24 spid8s Alter table systargetservers...
    2016-02-01 15:21:32.25 spid8s
    2016-02-01 15:21:32.25 spid8s Alter table sysjobsteps...
    2016-02-01 15:21:32.40 spid8s Configuration option 'allow updates' goes from 1 to 0. Run the RECONFIGURE statement to install.
    2016-02-01 15:21:32.40 spid8s Configuration option 'allow updates' goes from 1 to 0. Run the RECONFIGURE statement to install.
    2016-02-01 15:21:32.42 spid8s
    2016-02-01 15:21:32.42 spid8s-
    2016-02-01 15:21:32.42 spid8s PRE_SQLAGENT100 execution. Full SQL
    2016-02-01 15:21:32.42 spid8s-
    2016-02-01 15:21:32.46 spid8s DMF pre-shaping within walking distance...
    2016-02-01 15:21:32.83 spid8s DC pre-shaping within walking distance...
    2016-02-01 15:21:32.83 spid8s check if Data collector config table exists...
    2016-02-01 15:21:32.84 spid8s State of collector of data before the update: 0
    2016-02-01 15:21:32.84 spid8s pre_dc100::Check if syscollector_collection_sets_internal table exists...
    2016-02-01 15:21:32.84 spid8s pre_dc100::Capturing Collection to define the status of temporary table...
    2016-02-01 15:21:33.05 spid8s Deleting cached generated automatically collect T - SQL packages to msdb data...
    2016-02-01 15:21:33.05 spid8s end of the DC pre-staged to level as follows.
    2016-02-01 15:21:33.05 spid8s DAC pre-shaping within walking distance...
    2016-02-01 15:21:33.06 spid8s from CAD pre-shaping within walking distance...
    2016-02-01 15:21:33.06 spid8s end of the CAD pre-staged to level as follows.
    2016-02-01 15:21:33.06 spid8s-
    2016-02-01 15:21:33.06 spid8s start execution of MSDB. SQL
    2016-02-01 15:21:33.06 spid8s-
    2016-02-01 15:21:33.19 spid8s Configuration option 'allow updates' from 0 to 1. Run the RECONFIGURE statement to install.

    2016-02-01 15:21:33.19 spid8s Configuration option 'allow updates' from 0 to 1. Run the RECONFIGURE statement to install.
    2016-02-01 15:21:33.37 spid8s check the size of the MSDB.
    2016-02-01 15:21:33.63 spid8s error: 8966, severity: 16, State: 2.
    2016-02-01 15:21:33.63 spid8s can not read and lock the page (1:56616) with lock type SH. page no ID invalid. has failed.
    2016-02-01 15:21:33.63 spid8s error: 8946, severity: 16, State: 12.
    2016-02-01 15:21:33.63 spid8s Table error: Allocation page (1:56616) has invalid header values to the PFS_PAGE page. The type is 0. Check the type, unit ID of ID and the ID of the page on the page.
    2016-02-01 15:21:33.63 spid8s error: 912, severity: 21, State: 2.
    2016-02-01 15:21:33.63 spid8s Script level upgrade for database 'master' failed because upgrade step 'msdb110_upgrade.sql' has detected 3601, an error state 5, severity 25. It is a serious condition that could interfere with the normal operation and the database is taken offline. If the error occurred during the upgrade of the 'master' database, it will prevent the entirety of a SQL Server instance to start. Review the previous entries in the error log, take appropriate corrective action and restart the database so that the script upgrade steps run until the end.
    2016-02-01 15:21:33.64 spid8s error: 3417, severity: 21, State: 3.
    2016-02-01 15:21:33.64 spid8s cannot recover the master database. SQL Server cannot run. Master of restoring a full backup, repair or rebuild. For more information on how to rebuild the master database, see the SQL Server online documentation.
    2016-02-01 15:21:33.64 spid8s stop SQL Server launched
    2016-02-01 15:21:33.64 spid8s trace SQL stopped due to server shutdown. Trace ID = "1". This is an informational message only; no user action is required.
    2016-02-01 15:21:34.70 spid8s error: 25725, severity: 16, State: 1.
    2016-02-01 15:21:34.70 spid8s an error occurred trying to empty sessions extended all running events.  Some events may be lost.
    2016-02-01 15:21:34.71 spid13s the SQL Server Network Interface library could not deregister the Service Principal Name (SPN) [MSSQLSvc/servername.urldomain] for the SQL Server service. Error: 0x2af9, State: 61. Administrator should deregister this SPN manually to avoid client authentication errors.
    2016-02-01 15:21:34.71 spid13s the SQL Server Network Interface library could not deregister the Service Principal Name (SPN) [MSSQLSvc / servername.urldomain:1433] for the SQL Server service. Error: 0x2af9, State: 61. Administrator should deregister this SPN manually to avoid client authentication errors.

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

    I would be grateful for all the help I can get. Thank you.

    Hello

    Your question is beyond the scope of this community.

    Please repost your question in the SQL Server TechNet Forums.

    https://social.technet.Microsoft.com/forums/SQLServer/en-us/home?category=SQLServer

    TechNet Server forums.

    http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    See you soon.

  • Question to load data using sql loader in staging table, and then in the main tables!

    Hello

    I'm trying to load data into our main database table using SQL LOADER. data will be provided in separate pipes csv files.

    I have develop a shell script to load the data and it works fine except one thing.

    Here are the details of a data to re-create the problem.

    Staging of the structure of the table in which data will be filled using sql loader

    create table stg_cmts_data (cmts_token varchar2 (30), CMTS_IP varchar2 (20));

    create table stg_link_data (dhcp_token varchar2 (30), cmts_to_add varchar2 (200));

    create table stg_dhcp_data (dhcp_token varchar2 (30), DHCP_IP varchar2 (20));

    DATA in the csv file-

    for stg_cmts_data-

    cmts_map_03092015_1.csv

    WNLB-CMTS-01-1. 10.15.0.1

    WNLB-CMTS-02-2 | 10.15.16.1

    WNLB-CMTS-03-3. 10.15.48.1

    WNLB-CMTS-04-4. 10.15.80.1

    WNLB-CMTS-05-5. 10.15.96.1

    for stg_dhcp_data-

    dhcp_map_03092015_1.csv

    DHCP-1-1-1. 10.25.23.10, 25.26.14.01

    DHCP-1-1-2. 56.25.111.25, 100.25.2.01

    DHCP-1-1-3. 25.255.3.01, 89.20.147.258

    DHCP-1-1-4. 10.25.26.36, 200.32.58.69

    DHCP-1-1-5 | 80.25.47.369, 60.258.14.10

    for stg_link_data

    cmts_dhcp_link_map_0309151623_1.csv

    DHCP-1-1-1. WNLB-CMTS-01-1,WNLB-CMTS-02-2

    DHCP-1-1-2. WNLB-CMTS-03-3,WNLB-CMTS-04-4,WNLB-CMTS-05-5

    DHCP-1-1-3. WNLB-CMTS-01-1

    DHCP-1-1-4. WNLB-CMTS-05-8,WNLB-CMTS-05-6,WNLB-CMTS-05-0,WNLB-CMTS-03-3

    DHCP-1-1-5 | WNLB-CMTS-02-2,WNLB-CMTS-04-4,WNLB-CMTS-05-7

    WNLB-DHCP-1-13 | WNLB-CMTS-02-2

    Now, after loading these data in the staging of table I have to fill the main database table

    create table subntwk (subntwk_nm varchar2 (20), subntwk_ip varchar2 (30));

    create table link (link_nm varchar2 (50));

    SQL scripts that I created to load data is like.

    coil load_cmts.log

    Set serveroutput on

    DECLARE

    CURSOR c_stg_cmts IS SELECT *.

    OF stg_cmts_data;

    TYPE t_stg_cmts IS TABLE OF stg_cmts_data % ROWTYPE INDEX BY pls_integer;

    l_stg_cmts t_stg_cmts;

    l_cmts_cnt NUMBER;

    l_cnt NUMBER;

    NUMBER of l_cnt_1;

    BEGIN

    OPEN c_stg_cmts.

    Get the c_stg_cmts COLLECT in BULK IN l_stg_cmts;

    BECAUSE me IN l_stg_cmts. FIRST... l_stg_cmts. LAST

    LOOP

    SELECT COUNT (1)

    IN l_cmts_cnt

    OF subntwk

    WHERE subntwk_nm = l_stg_cmts (i) .cmts_token;

    IF l_cmts_cnt < 1 THEN

    INSERT

    IN SUBNTWK

    (

    subntwk_nm

    )

    VALUES

    (

    l_stg_cmts (i) .cmts_token

    );

    DBMS_OUTPUT. Put_line ("token has been added: ' |") l_stg_cmts (i) .cmts_token);

    ON THE OTHER

    DBMS_OUTPUT. Put_line ("token is already present'");

    END IF;

    WHEN l_stg_cmts EXIT. COUNT = 0;

    END LOOP;

    commit;

    EXCEPTION

    WHILE OTHERS THEN

    Dbms_output.put_line ('ERROR' |) SQLERRM);

    END;

    /

    output

    for dhcp


    coil load_dhcp.log

    Set serveroutput on

    DECLARE

    CURSOR c_stg_dhcp IS SELECT *.

    OF stg_dhcp_data;

    TYPE t_stg_dhcp IS TABLE OF stg_dhcp_data % ROWTYPE INDEX BY pls_integer;

    l_stg_dhcp t_stg_dhcp;

    l_dhcp_cnt NUMBER;

    l_cnt NUMBER;

    NUMBER of l_cnt_1;

    BEGIN

    OPEN c_stg_dhcp.

    Get the c_stg_dhcp COLLECT in BULK IN l_stg_dhcp;

    BECAUSE me IN l_stg_dhcp. FIRST... l_stg_dhcp. LAST

    LOOP

    SELECT COUNT (1)

    IN l_dhcp_cnt

    OF subntwk

    WHERE subntwk_nm = l_stg_dhcp (i) .dhcp_token;

    IF l_dhcp_cnt < 1 THEN

    INSERT

    IN SUBNTWK

    (

    subntwk_nm

    )

    VALUES

    (

    l_stg_dhcp (i) .dhcp_token

    );

    DBMS_OUTPUT. Put_line ("token has been added: ' |") l_stg_dhcp (i) .dhcp_token);

    ON THE OTHER

    DBMS_OUTPUT. Put_line ("token is already present'");

    END IF;

    WHEN l_stg_dhcp EXIT. COUNT = 0;

    END LOOP;

    commit;

    EXCEPTION

    WHILE OTHERS THEN

    Dbms_output.put_line ('ERROR' |) SQLERRM);

    END;

    /

    output

    for link -.

    coil load_link.log

    Set serveroutput on

    DECLARE

    l_cmts_1 VARCHAR2 (4000 CHAR);

    l_cmts_add VARCHAR2 (200 CHAR);

    l_dhcp_cnt NUMBER;

    l_cmts_cnt NUMBER;

    l_link_cnt NUMBER;

    l_add_link_nm VARCHAR2 (200 CHAR);

    BEGIN

    FOR (IN) r

    SELECT dhcp_token, cmts_to_add | ',' cmts_add

    OF stg_link_data

    )

    LOOP

    l_cmts_1: = r.cmts_add;

    l_cmts_add: = TRIM (SUBSTR (l_cmts_1, 1, INSTR (l_cmts_1, ',') - 1));

    SELECT COUNT (1)

    IN l_dhcp_cnt

    OF subntwk

    WHERE subntwk_nm = r.dhcp_token;

    IF l_dhcp_cnt = 0 THEN

    DBMS_OUTPUT. Put_line ("device not found: ' |") r.dhcp_token);

    ON THE OTHER

    While l_cmts_add IS NOT NULL

    LOOP

    l_add_link_nm: = r.dhcp_token |' _TO_' | l_cmts_add;

    SELECT COUNT (1)

    IN l_cmts_cnt

    OF subntwk

    WHERE subntwk_nm = TRIM (l_cmts_add);

    SELECT COUNT (1)

    IN l_link_cnt

    LINK

    WHERE link_nm = l_add_link_nm;

    IF l_cmts_cnt > 0 AND l_link_cnt = 0 THEN

    INSERT INTO link (link_nm)

    VALUES (l_add_link_nm);

    DBMS_OUTPUT. Put_line (l_add_link_nm |) » '||' Has been added. ") ;

    ELSIF l_link_cnt > 0 THEN

    DBMS_OUTPUT. Put_line (' link is already present: ' | l_add_link_nm);

    ELSIF l_cmts_cnt = 0 then

    DBMS_OUTPUT. Put_line (' no. CMTS FOUND for device to create the link: ' | l_cmts_add);

    END IF;

    l_cmts_1: = TRIM (SUBSTR (l_cmts_1, INSTR (l_cmts_1, ',') + 1));

    l_cmts_add: = TRIM (SUBSTR (l_cmts_1, 1, INSTR (l_cmts_1, ',') - 1));

    END LOOP;

    END IF;

    END LOOP;

    COMMIT;

    EXCEPTION

    WHILE OTHERS THEN

    Dbms_output.put_line ('ERROR' |) SQLERRM);

    END;

    /

    output

    control files -

    DOWNLOAD THE DATA

    INFILE 'cmts_data.csv '.

    ADD

    IN THE STG_CMTS_DATA TABLE

    When (cmts_token! = ") AND (cmts_token! = 'NULL') AND (cmts_token! = 'null')

    and (cmts_ip! = ") AND (cmts_ip! = 'NULL') AND (cmts_ip! = 'null')

    FIELDS TERMINATED BY ' |' SURROUNDED OF POSSIBLY "" "

    TRAILING NULLCOLS

    ('RTRIM (LTRIM (:cmts_token))' cmts_token,

    cmts_ip ' RTRIM (LTRIM(:cmts_ip)) ")". "

    for dhcp.


    DOWNLOAD THE DATA

    INFILE 'dhcp_data.csv '.

    ADD

    IN THE STG_DHCP_DATA TABLE

    When (dhcp_token! = ") AND (dhcp_token! = 'NULL') AND (dhcp_token! = 'null')

    and (dhcp_ip! = ") AND (dhcp_ip! = 'NULL') AND (dhcp_ip! = 'null')

    FIELDS TERMINATED BY ' |' SURROUNDED OF POSSIBLY "" "

    TRAILING NULLCOLS

    ('RTRIM (LTRIM (:dhcp_token))' dhcp_token,

    dhcp_ip ' RTRIM (LTRIM(:dhcp_ip)) ")". "

    for link -.

    DOWNLOAD THE DATA

    INFILE 'link_data.csv '.

    ADD

    IN THE STG_LINK_DATA TABLE

    When (dhcp_token! = ") AND (dhcp_token! = 'NULL') AND (dhcp_token! = 'null')

    and (cmts_to_add! = ") AND (cmts_to_add! = 'NULL') AND (cmts_to_add! = 'null')

    FIELDS TERMINATED BY ' |' SURROUNDED OF POSSIBLY "" "

    TRAILING NULLCOLS

    ('RTRIM (LTRIM (:dhcp_token))' dhcp_token,

    cmts_to_add TANK (4000) RTRIM (LTRIM(:cmts_to_add)) ")" ""

    SHELL SCRIPT-

    If [!-d / log]

    then

    Mkdir log

    FI

    If [!-d / finished]

    then

    mkdir makes

    FI

    If [!-d / bad]

    then

    bad mkdir

    FI

    nohup time sqlldr username/password@SID CONTROL = load_cmts_data.ctl LOG = log/ldr_cmts_data.log = log/ldr_cmts_data.bad DISCARD log/ldr_cmts_data.reject ERRORS = BAD = 100000 LIVE = TRUE PARALLEL = TRUE &

    nohup time username/password@SID @load_cmts.sql

    nohup time sqlldr username/password@SID CONTROL = load_dhcp_data.ctl LOG = log/ldr_dhcp_data.log = log/ldr_dhcp_data.bad DISCARD log/ldr_dhcp_data.reject ERRORS = BAD = 100000 LIVE = TRUE PARALLEL = TRUE &

    time nohup sqlplus username/password@SID @load_dhcp.sql

    nohup time sqlldr username/password@SID CONTROL = load_link_data.ctl LOG = log/ldr_link_data.log = log/ldr_link_data.bad DISCARD log/ldr_link_data.reject ERRORS = BAD = 100000 LIVE = TRUE PARALLEL = TRUE &

    time nohup sqlplus username/password@SID @load_link.sql

    MV *.log. / log

    If the problem I encounter is here for loading data in the link table that I check if DHCP is present in the subntwk table, then continue to another mistake of the newspaper. If CMTS then left create link to another error in the newspaper.

    Now that we can here multiple CMTS are associated with unique DHCP.

    So here in the table links to create the link, but for the last iteration of the loop, where I get separated by commas separate CMTS table stg_link_data it gives me log as not found CMTS.

    for example

    DHCP-1-1-1. WNLB-CMTS-01-1,WNLB-CMTS-02-2

    Here, I guess to link the dhcp-1-1-1 with balancing-CMTS-01-1 and wnlb-CMTS-02-2

    Theses all the data present in the subntwk table, but still it gives me journal wnlb-CMTS-02-2 could not be FOUND, but we have already loaded into the subntwk table.

    same thing is happening with all the CMTS table stg_link_data who are in the last (I think here you got what I'm trying to explain).

    But when I run the SQL scripts in the SQL Developer separately then it inserts all valid links in the table of links.

    Here, she should create 9 lines in the table of links, whereas now he creates only 5 rows.

    I use COMMIT in my script also but it only does not help me.

    Run these scripts in your machine let me know if you also get the same behavior I get.

    and please give me a solution I tried many thing from yesterday, but it's always the same.

    It is the table of link log

    link is already present: dhcp-1-1-1_TO_wnlb-cmts-01-1

    NOT FOUND CMTS for device to create the link: wnlb-CMTS-02-2

    link is already present: dhcp-1-1-2_TO_wnlb-cmts-03-3
    link is already present: dhcp-1-1-2_TO_wnlb-cmts-04-4

    NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-5

    NOT FOUND CMTS for device to create the link: wnlb-CMTS-01-1

    NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-8
    NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-6
    NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-0

    NOT FOUND CMTS for device to create the link: wnlb-CMTS-03-3

    link is already present: dhcp-1-1-5_TO_wnlb-cmts-02-2
    link is already present: dhcp-1-1-5_TO_wnlb-cmts-04-4

    NOT FOUND CMTS for device to create the link: wnlb-CMTS-05-7

    Device not found: wnlb-dhcp-1-13

    IF NEED MORE INFORMATION PLEASE LET ME KNOW

    Thank you

    I felt later in the night that during the loading in the staging table using UNIX machine he created the new line for each line. That is why the last CMTS is not found, for this I use the UNIX 2 BACK conversion and it starts to work perfectly.

    It was the dos2unix error!

    Thank you all for your interest and I may learn new things, as I have almost 10 months of experience in (PLSQL, SQL)

  • When I filled a form field using a query SQL result is displayed but not registered in the table.

    I write in the topic, I have created a form and in some of their fields, I used a SQL query to get information from a table based on the user who has been logging.

    The information displayed well, but when I press "Send button" loses information and the field in the table is shown empty.


    Anyone know what is happening?

    I enclose below a picture of the problem

    Concerning

    Problema DB APEX.jpg

    Hi ANTHONY,.

    ANTHONY wrote:

    I give you the credentials of my database, I hope you could do it works and most importantly, showing me what the error care...

    Feel free to change what you want in the application

    https://Apex.Oracle.com/pls/Apex/f?p=4550:1:2838412118981:

    BANCO_PRUEBAS

    ADMIN

    password

    It is interesting that, when I use APEX 5.0.1.00.06, I have some errors form appearing not using APEX 4.1.0.00.32

    Check your 77569 application-> Page 1. I have modified the page element attributes. Now it's working.

    Here are the changes (I will explain for P1_NOMBRE, did the same for the P1_APELLIDOS and P1_CATEGORIA):

    • 'Source' has become article attributed to him include:

    Source: Replacement always, value that exists in session state

    Source type: column database

    Source of value or an expression: NUMBER

    • The "Default" article now the following attributes:

    By default of Type: PL/SQL function body

    Default value:

    DECLARE
    
      L_NOMBRE B_LISTA_EMPLEADOS.NOMBRE%TYPE;
    
    BEGIN
    
      select NOMBRE
      into   L_NOMBRE
      from   B_LISTA_EMPLEADOS
      where  USERNAME = :APP_USER;
    
      RETURN L_NOMBRE;
    
    EXCEPTION
      WHEN NO_DATA_FOUND THEN
      RETURN NULL;
    
    END;
    

    Kind regards

    Kiran

  • Question: insertion of several lines in the MS Sql Server table using the DB adapter

    Hi all

    I managed to insert a single row in a table of MS SQL Server via the adapter DB to my process BPEL, but when I tried to insert in mutiple lines in the same table of MS SQL server, I encounter the error below.

    I use a DB SQL XA connection to connect to the server.

    Kindly help me to solve the problem. Thanks in advance.

    Error:

    " < bpelFault > < faultType > 0 < / faultType > < remoteFault xmlns =" http://schemas.Oracle.com/BPEL/extension "> < a name ="summary"part > < summary > exemption is is produced when the binding was used." Exception occurred during invocation of the JCA binding: "JCA binding run 'merge' reference operations have to: DBWriteInteractionSpec Execute Failed Exception." the merger failed. The descriptor name: [LoadCmpAggSpendStage.SapTable]. Caused by com.microsoft.sqlserver.jdbc.SQLServerException: incorrect syntax near ')'... Check the logs for the record output full DBAdapter before this exception. This exception is considered as reproducible, probably due to a communication failure. To be classified as not reproducible rather add property nonRetriableErrorCodes with the '102' value in the deployment descriptor (i.e. weblogic - RA.Xml). Auto retry a reproducible fault set composite.xml for this invoke these properties: jca.retry.interval, jca.retry.count and jca.retry.backoff. All properties are integers. ". The called JCA adapter threw an exception of resource. Please examine the error message above carefully to determine a resolution. < /Summary. (> < / piece > < part name = "detail" > < detail syntax > incorrect near ')'. < / details > < / piece > < part name = "code" > < code > 102 < / code > < / piece > < / remoteFault > < / bpelFault >

    Kind regards

    Balaji Rahmani

    It seems that in this case is called merge operation. If existing records (check primary key) are not there then it will be inserted on the other update. Check the syntax of the query that is created. It looks like she may have a supplement "). If you want to only insert then call insert operation and not merge.

Maybe you are looking for