Concatinating join query results

Hello

Is it possible to concatenate the value of a particular column that are the result of a join query.

Employee
Employee Id | Employee Name
254         | Employee 01 
266         | Employee 02 
654         | Employee 03
741         | Employee 04
266         | Employee 05
877         | Employee 06
955         | Employee 07
Project
Project Id | Project Name 
1          | Project 01   
2          | Project 02       
3          | Project 03               
Project_Employee
Project Id | Employee ID 
1          | 254         
1          | 266        
1          | 654        
2          | 741        
2          | 266        
3          | 877          
2          | 955        
Result
Project Id | Project Name | Employees
1          | Project 01   | Employee 01,  Employee 02,  Employee 03
2          | Project 02   | Employee 04, Employee 05, Employee 07
3          | Project 03   | Employee 06         
I use oracle 10g

Thank you

Hello

SQL> with employee as (
  2  select 254 employee_id, 'Employee 01' employee_name from dual  union all
  3  select 266, 'Employee 02' from dual  union all
  4  select 654, 'Employee 03' from dual union all
  5  select 741,  'Employee 04' from dual union all
  6  select 266, 'Employee 05' from dual union all
  7  select 877, 'Employee 06'from dual union all
  8  select  955,         'Employee 07' from dual),
  9  project as (
 10  select  1 project_id,'Project 01' project_name  from  dual union all
 11  select 2 , 'Project 02' from dual  union all
 12  select 3, 'Project 03' from dual),
 13  project_employee as(
 14  select 1 project_id,         254  employee_id from dual union all
 15  select 1 ,         266  from  dual union all
 16  select 1 ,654 from  dual union all
 17  select 2,741  from dual union all
 18  select 2 , 266   from dual  union all
 19  select 3 , 877  from dual union all
 20  select 2 ,955 from dual),
 21  a  as (select  p.project_id, p.project_name, e.employee_id, e.employee_name

 22              from employee e, project p, project_employee pe
 23              where pe.project_id = P.project_id
 24              and pe.employee_id = e.employee_id)
 25              select a.project_id proj_id  , a.project_name proj_name,
 26                    rtrim(xmlagg(xmlelement("enam",
 27                                         a.employee_name || ', ')
 28                    order by employee_id).extract('//text()'),', ')
 29                     as employee_names
 30              from a
 31              group by a.project_id,a.project_name;

   PROJ_ID PROJ_NAME
---------- ----------
EMPLOYEE_NAMES
--------------------------------------------------------------------------------

         1 Project 01
Employee 01, Employee 02, Employee 05, Employee 03

         2 Project 02
Employee 02, Employee 05, Employee 04, Employee 07

         3 Project 03
Employee 06

SQL>

The output may be formatted, but the result is what you want.

Tags: Database

Similar Questions

  • Different Outer Join query result

    Hi all

    Under query gives the expected result


    Select DECODE (FPOVR. PROFILE_OPTION_VALUE,
    NULL, FPOVS. PROFILE_OPTION_VALUE, FPOVR. ZZ PROFILE_OPTION_VALUE)
    OPS FND_PROFILE_OPTIONS, FND_PROFILE_OPTION_VALUES FPOVR,.
    FND_PROFILE_OPTION_VALUES FPOVS where 1 = 1 and FPOVS. LEVEL_ID (+) = 10001
    and FPOVS. LEVEL_VALUE (+) = 0
    and FPOVS. PROFILE_OPTION_ID (+) IS FRENCH POLYNESIA. PROFILE_OPTION_ID
    and FPOVR. (+) LEVEL_ID = 10003 and FPOVR. LEVEL_VALUE (+) = 21533
    and FPOVR. PROFILE_OPTION_ID (+) IS FRENCH POLYNESIA. PROFILE_OPTION_ID
    and fpo.profile_option_name = 'GL_SET_OF_BKS_ID. '


    But the following query does not give the expected result.


    Select DECODE (FPOVR. PROFILE_OPTION_VALUE,
    NULL, FPOVS. PROFILE_OPTION_VALUE, FPOVR. ZZ PROFILE_OPTION_VALUE)
    OPS FND_PROFILE_OPTIONS, FND_PROFILE_OPTION_VALUES FPOVR,.
    FND_PROFILE_OPTION_VALUES FPOVS where 1 = 1 and FPOVS. LEVEL_ID (+) = 10001
    and FPOVS. LEVEL_VALUE (+) = 0
    and FPOVS. PROFILE_OPTION_ID (+) IS FRENCH POLYNESIA. PROFILE_OPTION_ID
    and FPOVR. (+) LEVEL_ID = 10003 and FPOVR. LEVEL_VALUE = 21533
    and FPOVR. PROFILE_OPTION_ID (+) IS FRENCH POLYNESIA. PROFILE_OPTION_ID
    and fpo.profile_option_name = 'GL_SET_OF_BKS_ID. '

    Difference between them is a join with external FPOVR. LEVEL_VALUE and hard coded value. Why these query above return different results even if the outer join is made with hard coded in value?

    Thank you
    SK

    SK says:
    Hi all

    Under query gives the expected result

    Select DECODE (FPOVR. PROFILE_OPTION_VALUE,
    NULL, FPOVS. PROFILE_OPTION_VALUE, FPOVR. ZZ PROFILE_OPTION_VALUE)
    OPS FND_PROFILE_OPTIONS, FND_PROFILE_OPTION_VALUES FPOVR,.
    FND_PROFILE_OPTION_VALUES FPOVS where 1 = 1 and FPOVS. LEVEL_ID (+) = 10001
    and FPOVS. LEVEL_VALUE (+) = 0
    and FPOVS. PROFILE_OPTION_ID (+) IS FRENCH POLYNESIA. PROFILE_OPTION_ID
    and FPOVR. (+) LEVEL_ID = 10003 and FPOVR. LEVEL_VALUE (+) = 21533
    and FPOVR. PROFILE_OPTION_ID (+) IS FRENCH POLYNESIA. PROFILE_OPTION_ID
    and fpo.profile_option_name = 'GL_SET_OF_BKS_ID. '

    But the following query does not give the expected result.

    Select DECODE (FPOVR. PROFILE_OPTION_VALUE,
    NULL, FPOVS. PROFILE_OPTION_VALUE, FPOVR. ZZ PROFILE_OPTION_VALUE)
    OPS FND_PROFILE_OPTIONS, FND_PROFILE_OPTION_VALUES FPOVR,.
    FND_PROFILE_OPTION_VALUES FPOVS where 1 = 1 and FPOVS. LEVEL_ID (+) = 10001
    and FPOVS. LEVEL_VALUE (+) = 0
    and FPOVS. PROFILE_OPTION_ID (+) IS FRENCH POLYNESIA. PROFILE_OPTION_ID
    and FPOVR. (+) LEVEL_ID = 10003 and FPOVR. LEVEL_VALUE = 21533
    and FPOVR. PROFILE_OPTION_ID (+) IS FRENCH POLYNESIA. PROFILE_OPTION_ID
    and fpo.profile_option_name = 'GL_SET_OF_BKS_ID. '

    Difference between them is a join with external FPOVR. LEVEL_VALUE and hard coded value.

    In fact, the difference is that the condition relating to FPOVR. LEVEL_VALUE to 21533 is part of the outer join condition in the first query, but it is not in the second query.

    Why these query above return different results even if the outer join is made with hard coded in value?

    When you say

    FPOVR.LEVEL_VALUE(+) = 21533
    

    (with a sign +) only the lines of fpovr with level_value = 21533 will join the other table. If there is no such line in fpovr, then a row of output will be generatedd for each row in the other table anyway.
    When you say

    FPOVR.LEVEL_VALUE = 21533
    

    (without a sign +) then the outer join is made using the other conditions, which may result in some lines of the other table who appear in the result set with NULL in places where the values of fpovr would normally appear. Then when the join is complete, the condition is applied, and all these lines with the NULL value instead of fpovr.level_value are deleted because they do not meet the condition "FPOVR. LEVEL_VALUE = 21533 ". The effect is identical to an inner join.

    When you use the old rating of outer join (i.e. with signs +), if any condition involving the fpovr table has a + sign, and then all of the conditions involving table fpovr must have a + sign, otherwise the result will be the same if none of the conditions were a sign +.

  • Need help to understand the query result

    Hi gurus

    I was reading one of the question here in this forum and its link is below:

    Query required for scenario

    I had some confusion related to this code and don't understand the logic of the out put, see query below:

    Query

    with sub_services as

    (

    Select su_seq 12323, 'HLR1' so_id, 1 seq Union double all the

    Select su_seq 12323, "HLR2' so_id, seq 2 Union double all the

    Select su_seq 12323, "A09" so_id, seq 3 of all the double union

    Select su_seq 12333, "MO1" so_id, seq 4 Union double all the

    Select su_seq 12333, "MO2' so_id, seq 5 Union double all the

    Select su_seq 12333, "A09" so_id, 6 seq in union double all the

    Select su_seq 12333, 'M0CR' so_id, seq 7 Union double all the

    Select su_seq 12999, "LOL1' so_id, seq 8 Union double all the

    Select su_seq 12999, "LOL2' so_id, seq 9 double

    )

    Select *.

    of sub_services b

    where exists (select 1 from sub_services

    where su_seq = b.su_seq

    and so_id = 'A09.

    )

    order by 2;

    The query result

    12323 A09 3

    12333 6 A09

    12323 HLR1 1

    12323 HLR2 2

    12333 M0CR 7

    12333 4 MO1

    12333 5 MO2

    According to my understanding, the above query should return records in red only because of her is below command

    It exists (select 1 from sub_services

    where su_seq = b.su_seq

    and so_id = 'A09.

    but don't know why he's back 7 files, can someone help me understand the result...

    It is query is functionally identical to the PL/SQL block, but much more effective.

    declare

    number of l_res;

    Start

    for line (select *)

    sub_services) loop

    Start

    Select 1 from l_res

    of sub_services

    where su_seq = row.su_seq and

    so_id = "A09" and

    rownum = 1;

    exception when

    NO_DATA_FOUND then

    null;

    end;

    end loop;

    end;

    Essentially every row in the outer query are tested against him exists query.  Given the correlation between two requests is based only on su_seq each line with a su_seq value returned by him is returned in the output.

    Another way to think he uses instead a join condition.  This query is equivalent to the query to exist

    Select the main

    of main sub_services

    Join select (separate su_seq

    of sub_services

    where so_id = "A09") cond

    We main.su_seq = cond.su_seq;

    John

  • Query results pane should display the entire XML following the execution of the query

    Hi, I'm trying to get the xml output results returned in sqldeveloper returned in full.

    they are truncated to.

    I tried the trick / * xml * / but that is implemented in the form xml cdata codes and other structures of nickname.

    Select xmlserialize (DOCUMENT

    XMLELEMENT ("root",

    XMLAttributes ('http://www.millicom.com' as 'xmlns'),

    XMLAGG)

    XMLELEMENT ("line",

    XMLFOREST (U.username,

    U.user_id,

    U.PASSWORD,

    U.ACCOUNT_STATUS,

    U.LOCK_DATE,

    U.EXPIRY_DATE,

    U.DEFAULT_TABLESPACE,

    U.TEMPORARY_TABLESPACE,

    U.CREATED,

    U.PROFILE,

    U.INITIAL_RSRC_CONSUMER_GROUP,

    U.EXTERNAL_NAME,

    U.PASSWORD_VERSIONS,

    U.EDITIONS_ENABLED,

    U.AUTHENTICATION_TYPE)))

    AS CLOB DASH)

    from dba_users U

    CROSS JOIN (select 1 of the double connect by level < = 10);

    Thanks for any help you can offer.


    JM

    Hi jm,

    In the line of query results, did scroll all the way to the right, then click twice on the «...» "at the end of the line to open the cell editor?

    So again, who does not show all the XML, it may be a problem with the version of the ojdb6.jar in use (11.2.0.3 client or later is required), or whether or not the JDBC OCI/thickness is used.  Read the following discussion: retrieve XMLTYPE based on very slow saved schema

    Kind regards

    Gary

    SQL development team

  • Duplicates in hierarchical query results

    Please use the suite of applications:

    CREATE TABLE EMP

    (NUMBER OF EMP_ID,

    EMP_NAME VARCHAR2 (50).

    NUMBER OF MANAGER_ID

    );

    INSERT INTO EMP VALUES(1,'SCOTT',);

    INSERT INTO EMP VALUES(2,'JOHN',1);

    INSERT INTO EMP VALUES(3,'ROB',2);

    INSERT INTO EMP VALUES(4,'MIKE',2);

    INSERT INTO EMP VALUES(5,'BOB',);

    INSERT INTO EMP VALUES(6,'JEFF',5);

    COMMIT;

    SELECT * FROM EMP, (SELECT EMP_ID FROM EMP WHERE EMP_ID IN (1.5)) TEMP

    START BY EMP. EMP_ID = TEMP. EMP_ID

    CONNECT BY PRIOR EMP. EMP_ID = EMP. MANAGER_ID;

    Basically, I first spend a few emp_ids a subquery and then want to see all records in the table emp which are direct or indirect of those emp_ids children.

    But I get a lot of duplicate records. Can someone explain what is the reason behind this? I can use SEPARATE and spend, but there could be a problem with my request in the first place.

    Help, please!

    Thank you

    RN

    Hello

    RN says:

    Please use the suite of applications:

    CREATE TABLE EMP

    (NUMBER OF EMP_ID,

    EMP_NAME VARCHAR2 (50).

    NUMBER OF MANAGER_ID

    );

    INSERT INTO EMP VALUES(1,'SCOTT',);

    INSERT INTO EMP VALUES(2,'JOHN',1);

    INSERT INTO EMP VALUES(3,'ROB',2);

    INSERT INTO EMP VALUES(4,'MIKE',2);

    INSERT INTO EMP VALUES(5,'BOB',);

    INSERT INTO EMP VALUES(6,'JEFF',5);

    COMMIT;

    SELECT * FROM EMP, (SELECT EMP_ID FROM EMP WHERE EMP_ID IN (1.5)) TEMP

    START BY EMP. EMP_ID = TEMP. EMP_ID

    CONNECT BY PRIOR EMP. EMP_ID = EMP. MANAGER_ID;

    Basically, I first spend a few emp_ids a subquery and then want to see all records in the table emp which are direct or indirect of those emp_ids children.

    But I get a lot of duplicate records. Can someone explain what is the reason behind this? I can use SEPARATE and spend, but there could be a problem with my request in the first place.

    Help, please!

    Thank you

    RN

    Thanks for posting the CREATE TABLE and INSERT statements; It is very useful.

    When you do CONNECT BY and joins in the same query (sub-), joins are made first, and then CONNECT BY is performed on all results of the joints.  In this example, you make a cross of PMCs and this join called temp.  Let's see what the result set looks like:

    SELECT *.

    WCP

    ,       (

    SELECT emp_ID

    WCP

    WHERE emp_id IN (1.5)

    ) temp

    ;

    Output:

    EMP_ID, EMP_NAME MANAGER_ID EMP_ID

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

    1 SCOTT 1

    2 1 1 JOHN

    3 ROB                 2          1

    4 1 2 MIKE

    5 BOB                            1

    JEFF 6 5 1

    1 SCOTT 5

    2 1 5 JOHN

    3 ROB                 2          5

    4 2 5 MIKE

    5 BOB                            5

    6 5 5 JEFF

    Now, you do a CONNECT BY query on the result set.  As you can see, there are 2 lines with emp_id = 2 in the set of results above, which explains why there are 2 lines in your query results with emp_id = 2.  Similarly, the output defined above, there are 2 lines with emp_id = 3, and they all have two manager_id = 2, each of them is considered to be a child of each of each of the 2 rows with emp_id = 2, and therefore, you have 2 * 2 = 4 lines with emp_id = 3 in the output CONNECT BY.

    What is a cross here join?  Why must you temp?  Why not just a CONNECT BY questioning one emp, like this:

    SELECT *.

    WCP

    START WITH emp_id IN (1, 5)

    CONNECT BY PRIOR Emp_id = manager_id

    ;

    ?

  • Help on the game of query results

    Hi gurus,

    Have this survey for my requirement of dataset sql.

    Sample, it's that I have to pick up the nonfunctional currency transactions.

    Lets say for a given month, data that are present are for CurrencyA and CurrencyB for a particular account.

    Account1 has a transaction does not work CurrencyA and CurrenyB then Account2 has only transaction to CurrencyB.

    My current query result is that the 3 first lines, what I need is the 4th should also appear and be included.

    CurrencyA - amount - account1

    CurrencyB - amount - account1

    CurrencyB - amount - Account2

    CurrencyA - < '0' / or null >-Account2

    I think that my request is based on the currency < x > I have, so it should be for each account, he has all the lines for each currency.

    If please notify and let me know your thoughts.

    Kind regards

    Hello

    It looks like you want an outer join partitioned.

    I hope that answers your question.
    If not, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
    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: https://forums.oracle.com/message/9362002

  • using two sum() in multiple join query

    Hello

    I'm stuck with the help of two sum() functions in a single query. Are columns of different tables that are joined.

    table of charging

    Date pay_amt cust_id

    1 July 13 500 1

    1 July 13 200 1

    amount of usage

    Date usg_amt cust_id

    1 July 13 100 1

    2 July 13 300 2

    I want a single query to give me sum (pay_amt) and sum (usg_amt) for a client in a single day

    That is to say:

    o/p should be:

    cust_id date sum (pay_amt) sum (usg_amt)

    1 01 - Jul 700 100

    My query is like below. But it gives incorrect total for both. Could someone tell me why?

    Select sum (pay_amt), sum (usg_amt)

    from charging r

    join in-house use u

    On u.cust_id = r.ID_client

    and you.date = r.date

    where u.cust_id = 1

    and you.date = 1 July 13 '

    chris227 wrote:

    I seem to be a bug to me.

    The result is 11.2.0.3

    SUM(PAY_AMT) SUM(USG_AMT)
    700 200

    What is your version?

    What looks like the plan to explain it with predicates?

    BTW, why do you think that both are incorrect, for me, only the second is incorrect, should be 200 instead of 100.

    Post edited by: chris227 Question added

    No Chris, the po said they want the o/p 100, and they were getting an invalid value (for example, the 200 is incorrect).

    It's because of the joining of the usg_amt of duplication:

    SQL > ed
    A written file afiedt.buf

    1 refill as (select date "'2013-07-01 as dt, 500 as pay_amt, 1 as cust_id of union double all the")
    2 select dates "2013-07-01', 200, 1 double)
    3, use as (select date "'2013-07-01 as dt, 100 in usg_amt, 1 as cust_id of union double all the")
    4 Select the dates "2013-07-02', 300, 2 double)
    5  --
    6 select DT, pay_amt, usg_amt - sum (pay_amt), r.id_client, sum (usg_amt)
    7 recharge r
    8 join use u on u.cust_id = r.ID_client
    9 and you.dt = DT
    10 where u.cust_id = 1
    11 * and u.dt = date ' 01-07-2013'
    SQL > /.

    CUST_ID DT PAY_AMT USG_AMT
    ---------- -------------------- ---------- ----------
    1 1 JULY 2013 00:00:00 200 100
    1 1 JULY 2013 00:00:00 500 100

    If the sum is of course to sum up 100 twice because of two lines to pay.

    So why I have indicated that the aggregation (sum) should usually before the join is made, so it is only made the cust_id amount and date for each table and then joined the results.

  • Need help for a join query

    Hi, I'm a little stuck on getting the results of a join query. Let's say I have three tables that make up one of many to go from left to right:
    Project-> work-> work
    Each task can have many tasks. Each task in a job can be repeated by several users, each with a different assigned_name. The tasks of a job have a value of sequence (seq), so if the same task is repeated for a job, the seq will be different.
    I need to get the assigned_name of the last run of the task for each job. Here is the ddl:
    CREATE TABLE project (
    id          NUMBER PRIMARY KEY,
    name     VARCHAR2(20));
    
    INSERT INTO project (id, name) VALUES (1, 'Test Project 1');
    INSERT INTO project (id, name) VALUES (2, 'Test Project 2');
    
    CREATE TABLE job (
    id          NUMBER PRIMARY KEY,
    project_id NUMBER,
    name     VARCHAR2(20),
    CONSTRAINT fk_project 
       FOREIGN KEY (project_id) 
       REFERENCES project(id));
    
    INSERT INTO job (id, project_id, name) VALUES (11, 1, 'Test Job 1-11');
    INSERT INTO job (id, project_id, name) VALUES (12, 1, 'Test Job 1-12');
    INSERT INTO job (id, project_id, name) VALUES (13, 2, 'Test Job 2-13');
    INSERT INTO job (id, project_id, name) VALUES (14, 2, 'Test Job 2-14');
    INSERT INTO job (id, project_id, name) VALUES (15, 2, 'Test Job 2-15');
    
    CREATE TABLE task (
    id          NUMBER,
    seq NUMBER,
    job_id NUMBER,
    name     VARCHAR2(20),
    assigned_name          VARCHAR2(20),
    CONSTRAINT pk_task
       PRIMARY KEY (id, seq),
    CONSTRAINT fk_job
       FOREIGN KEY (job_id) 
       REFERENCES job(id));
    
    INSERT INTO task (id, seq, job_id, name, assigned_name) 
    VALUES (101, 1, 11, 'Test Task 1-11-101', 'Bob');
    INSERT INTO task (id, seq, job_id, name, assigned_name) 
    VALUES (102, 2, 11, 'Test Task 1-11-102', 'Jack');
    INSERT INTO task (id, seq, job_id, name, assigned_name) 
    VALUES (103, 1, 12, 'Test Task 1-12-103', 'Mary');
    INSERT INTO task (id, seq, job_id, name, assigned_name) 
    VALUES (104, 2, 12, 'Test Task 1-12-104', 'Phil');
    INSERT INTO task (id, seq, job_id, name, assigned_name) 
    VALUES (104, 3, 12, 'Test Task 1-12-104', 'Bill');
    INSERT INTO task (id, seq, job_id, name, assigned_name) 
    VALUES (105, 4, 12, 'Test Task 1-12-105', 'Ed');
    INSERT INTO task (id, seq, job_id, name, assigned_name) 
    VALUES (105, 5, 12, 'Test Task 1-12-105', 'Tom');
    INSERT INTO task (id, seq, job_id, name, assigned_name) 
    VALUES (105, 6, 12, 'Test Task 1-12-105', 'John');
    COMMIT;
    Now, if I run a query
    SELECT p.name project_name, j.name job_name, t.name task_name, t.seq, t.assigned_name
    FROM     project p, job j, task t
    WHERE p.id = j.project_id
    AND     j.id = t.job_id
    AND     t.job_id = 12
    ORDER BY 1,2,3,4;
    Then, I get:
    PROJECT_NAME         JOB_NAME             TASK_NAME                   SEQ ASSIGNED_NAME
    -------------------- -------------------- -------------------- ---------- --------------
    Test Project 1       Test Job 1-12        Test Task 1-12-103            1 Mary
    Test Project 1       Test Job 1-12        Test Task 1-12-104            2 Phil
    Test Project 1       Test Job 1-12        Test Task 1-12-104            3 Bill
    Test Project 1       Test Job 1-12        Test Task 1-12-105            4 Ed
    Test Project 1       Test Job 1-12        Test Task 1-12-105            5 Tom
    Test Project 1       Test Job 1-12        Test Task 1-12-105            6 John
    While I would like to:
    PROJECT_NAME         JOB_NAME             TASK_NAME                   SEQ ASSIGNED_NAME
    -------------------- -------------------- -------------------- ---------- --------------------
    Test Project 1       Test Job 1-12        Test Task 1-12-103            1 Mary
    Test Project 1       Test Job 1-12        Test Task 1-12-104            3 Bill
    Test Project 1       Test Job 1-12        Test Task 1-12-105            6 John
    i.e.
    For each combination of project.id/job.id/task.id, I need to get the record with the highest task.seq

    Any ideas? I'm puzzled.

    Thank you.

    I'm on 10g
    SQL> SELECT p.name project_name, j.name job_name, t.name task_name,
      2  max(t.seq) seq,
      3  max(t.assigned_name) keep (dense_rank first order by t.seq desc) assigned_name
      4  FROM project p, job j, task t
      5  WHERE p.id = j.project_id
      6  AND j.id = t.job_id
      7  AND t.job_id = 12
      8  GROUP BY p.name, j.name, t.name
      9  ORDER BY 1,2,3,4
     10  /
    
    PROJECT_NAME         JOB_NAME             TASK_NAME                   SEQ ASSIGNED_NAME
    -------------------- -------------------- -------------------- ---------- --------------------
    Test Project 1       Test Job 1-12        Test Task 1-12-103            1 Mary
    Test Project 1       Test Job 1-12        Test Task 1-12-104            3 Bill
    Test Project 1       Test Job 1-12        Test Task 1-12-105            6 John
    
    SQL> 
    

    SY.

  • Join query not received from WLC

    Hi all

    I am in the process of autonomous update 1242 (MIC) APs belongs to an external client to make them a part of the existing lwapp based infrastructure.

    I have seen successful negotiations of discovery. Then AP sends the join query, but the WLC debugging does not receive the product.

    1. the capture of wireshark packages indicates that Discovery & jOin process use identical to each phased ports: it will be exclude firewalls.

    2. no duplicate IPs

    3 controllers are not exhausted with APs

    4 DHCP option 43 is set up and could see it in action when I do a debug dhcp

    Another interesting observation is that I couldn't see any CERT on autonomous before conveting to lwapp APs when I have HS crypto pki certificates

    Please refer to the attachment for debugging output.

    Any help is very appreciated.

    see you soon,

    janesha

    You open the FW for UDP 12223 and also you have the ip helper and the ip Protocol before?

  • Need help to build the query/pl-sql block to get the query result and the name of column from DB table in the form of key-value pairs.

    Hi Experts,

    I have a DB table has columns of more than 50.

    I question this table, it should only return one line at any time. as sqldeveloper below image.

    here, I need to build block pl/sql-query, Discover the column in the table as a key and query result as values.

    Eg:     Key                         -  Value

    TASK_EVENT_ID - 1765

    EVENT_TYPE - ASR_UPDATE

    ... etc until all of the columns in my table.

    Experts please comment on that point, appreciate your help on this.

    Thank you

    -Vincent.

    Here is an approach using DBMS_SQL to iterate over the columns of key / value to assign... (Little code snipped for brevity)

    create or replace procedure (task_expired)

    v_store_id in full,

    v_task_action_id in full,

    v_job_id in full

    )

    as

    -[SNIP code...]

    v_sql VARCHAR2 (4000): = ' select * from my_table where PK = 123';  -Your SQL here!

    v_v_val VARCHAR2 (4000);

    v_n_val NUMBER;

    v_d_val DATE;

    v_ret NUMBER;

    c NUMBER;

    d NUMBER;

    col_cnt INTEGER.

    f BOOLEAN;

    rec_tab DBMS_SQL. DESC_TAB;

    col_num NUMBER;

    vAsString VARCHAR2 (4000);

    BEGIN

    -[SNIP code...]

    Message_properties. CORRELATION: = "EDF_EVENT";

    MSG: = SYS. AQ$ _JMS_BYTES_MESSAGE. Construct();

    Msg.set_string_property ('queueName', ' shipping/csi_cth');

    Msg.set_string_property ('MODE', 'CR8');

    c: = DBMS_SQL. OPEN_CURSOR;

    DBMS_SQL. PARSE (c, v_sql, DBMS_SQL. NATIVE);

    d: = DBMS_SQL. Execute (c);

    DBMS_SQL. DESCRIBE_COLUMNS (c, col_cnt, rec_tab);

    1.col_cnt J

    LOOP

    CASE rec_tab (j) .col_type

    WHEN 2 THEN

    DBMS_SQL. DEFINE_COLUMN (c, j, v_n_val);      -Number

    WHEN 12 CAN

    DBMS_SQL. DEFINE_COLUMN (c, j, v_d_val);      -Date

    ON THE OTHER

    DBMS_SQL. DEFINE_COLUMN (c, j, v_v_val, 2000);   -Else treat as varchar2

    END CASE;

    END LOOP;

    LOOP

    v_ret: = DBMS_SQL. FETCH_ROWS (c);

    WHEN OUTPUT v_ret = 0;

    1.col_cnt J

    LOOP

    -Fetch each column to the correct data type based on coltype

    CASE rec_tab (j) .col_type

    WHEN 2 THEN

    DBMS_SQL. COLUMN_VALUE (c, j, v_n_val);

    vAsString: = to_char (v_n_val);

    WHEN 12 CAN

    DBMS_SQL. COLUMN_VALUE (c, j, v_d_val);

    vAsString: = to_char (v_d_val, ' DD/MM/YYYY HH24:MI:SS');

    ON THE OTHER

    DBMS_SQL. COLUMN_VALUE (c, j, v_v_val);

    vAsString: = v_v_val;

    END CASE;

    Msg.set_string_property (rec_tab (j) .col_name, vAsString);

    END LOOP;

    END LOOP;

    DBMS_SQL. CLOSE_CURSOR (c);

    DBMS_AQ. ENQUEUE (queue_name-online 'cbus.aqjms_common',

    Enqueue_options => Enqueue_options,

    Message_properties => Message_properties,

    Payload-online msg,

    Msgid => Message_handle);

    dbms_output.put_line ('00 Msgid =' |) Message_handle);

    dbms_output.put_line('===Done=');

    -[SNIP code...]

    END;

    /

  • Query result cache

    Today I test the query result cache, but the result is not as I expected. Please give a few advices.thank you in advance.

    SQL > create table (qrc_tab)

    Number 2);

    Table created.

    SQL > insert into qrc_tab values (1);

    1 line of creation.

    SQL > insert into qrc_tab values (2);

    1 line of creation.

    SQL > insert into qrc_tab values (3);

    1 line of creation.

    SQL > insert into qrc_tab 4;

    1 line of creation.

    SQL > insert into qrc_tab values (5);

    1 line of creation.

    SQL > create or replace function slow_function (p_id in qrc_tab.id%TYPE)

    2 back qrc_tab.id%TYPE DETERMINISTIC AS

    3 BEGIN

    4 DBMS_LOCK.sleep (1);

    5 return p_id;

    6 end;

    7.

    The function is created.

    SQL > set timing on

    SQL > select slow_function (id) in the qrc_tab;

    SLOW_FUNCTION (ID)

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

    1

    2

    3

    4

    5

    Elapsed time: 00:00:05.01

    SQL > select / * + result_cache * / slow_function (id) of qrc_tab;

    SLOW_FUNCTION (ID)

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

    1

    2

    3

    4

    5

    Elapsed time: 00:00:05.00

    SQL > select / * + result_cache * / slow_function (id) of qrc_tab;

    SLOW_FUNCTION (ID)

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

    1

    2

    3

    4

    5

    Elapsed time: 00:00:05.00

    SQL > select / * + result_cache * / slow_function (id) of qrc_tab;

    SLOW_FUNCTION (ID)

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

    1

    2

    3

    4

    5

    Elapsed time: 00:00:05.00

    I wonder why time is not fast? Help, please

    create or replace function slow_function (p_id in qrc_tab.id%TYPE)

    return qrc_tab.id%TYPE result_cache DETERMINISTIC AS

    Start

    DBMS_LOCK. Sleep (1);

    return p_id;

    end;

    /

    --

    John Watson

    Oracle Certified Master s/n

  • How to get SQL Developer 4.1 to display the query result?

    SQL DEV 4.0.3.16.84 execution of a SELECT statement is stored in a .sql file causes the window of the query result of pop-up indicating the result of a SELECT statement.  SQL DEV 4.1 is not to do so.

    Oops on my part; my SQL formatting has been the root cause.  I got used to insert split without any character of comment lines in front of them.  For example:

    ==================================================

    Select funny business;

    The foregoing indicates the behavior described.

    --==================================================

    Select funny business;

    With the dash double comment shows, the SQL works very well.

    This is different than previous versions of SQL Developer, but is probably better functionality.  I'll try to mark it as answered, but anyone with the admin should certainly do so if I can't.

  • Need help with a query result

    Oracle Version: 11.2.0.2.0

    I need assistance with the output of the query. Here is the table.

    With Tbl_Nm as

    (

    Select 'ABC1' SYSTEM_ID, REGION 'US', 'CHI' SUB_REGION 4000 BALANCE, to_date('1-JUN-2012 10:45:00 am', 'dd-mon-yyyy hh:mi:ss am') LAST_UPD_TIME, 'A' FLAG of union double all the

    Select 'PQR2', 'UK', 'LN', 2000, To_Date('1-JUL-2012 10:46:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select 'ABC1', 'IND","MAMA", 3500, To_Date('1-AUG-2012 11:47:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "LMN3", "US", "NJ", 2500, To_Date('1-SEP-2012 09:49:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "PQR2", "UK", "MC", 2600, To_Date('1-OCT-2012 04:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select 'ABC1', 'US', 'NY', 3200, To_Date('1-OCT-2012 06:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select "LMN3", "UK", "BT", 2400, To_Date('1-NOV-2012 07:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' From Dual

    )

    Select * from tbl_nm

    I need the output below.

    PQR2 UK MC 2600 1 OCTOBER 2012 04:45

    ABC1 US NY 3500 October 1, 2012 06:45

    LMN3 UK BT 2500 November 1, 2012 07:45

    The need the disc according to this system_id flagged as "A". But if the last disc of 'd' then it must show that the amount, but the file should be displayed in 'A '.

    I've tried a few and got stuck. Help, please. Not able to get a balance '.

    This question is a bit similar to needing help with a query result

    With Tbl_Nm as

    (

    Select 'ABC1' System_Id, region 'US', 'CHI' Sub_Region, 4000 balance, To_Date('1-JUN-2012 10:45:00 am', 'dd-mon-yyyy hh:mi:ss am') Last_Upd_Time, 'A' flag of double Union All

    Select 'PQR2', 'UK', 'LN', 2000, To_Date('1-JUL-2012 10:46:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select 'ABC1', 'IND","MAMA", 3500, To_Date('1-AUG-2012 11:47:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "LMN3", "US", "NJ", 2500, To_Date('1-SEP-2012 09:49:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select "PQR2", "UK", "MC", 2600, To_Date('1-OCT-2012 04:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), 'A' from dual Union All

    Select 'ABC1', 'US', 'NY', 3200, To_Date('1-OCT-2012 06:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' starting from dual Union All

    Select "LMN3", "UK", "BT", 2400, To_Date('1-NOV-2012 07:45:00 am', 'dd-mon-yyyy hh:mi:ss am'), has ' From Dual

    )

    Select System_Id, region, Sub_Region, Balance, Last_Upd_Time of Tbl_Nm T1

    where t1. Last_Upd_Time = (select max (Last_Upd_Time) in the Tbl_Nm T2 where T1.) SYSTEM_ID = T2. SYSTEM_ID)

    So maybe you'd then

    ORDER BY DECODE(flag,'D',9,1) ASC...

    to get the Ds at the end of the list.

    or

    ORDER BY CASE WHAT flag = has ' (your other filters) AND then 9 or 1 end CSA,...

    HTH

  • new to 4.02, no grid or column names in the query results

    It is a bit strange, I have SQL Developer 4.02 just installed, and I don't see grid or column names in the query results.  Don't see anything useful in tools > Preferences, what don't get me?

    The worksheet gives you a couple of different ways to run a query...

    1. instruction execute sheet icon toolbar (large green arrow, or Ctrl + Enter).

    This produces a results tab of the query with the data displayed in a grid.

    2. worksheet icon toolbar Execute the Script (the small tip of the green arrow on lined paper, or F5).

    This produces a tab out of the Script with the data displayed on the printer.

    If execution of the statement to Execute the Script, using some SQL * most orders will remove the column headers:

    1. set the position

    2. set the pagesize 0 (or 1 or 2).

    Pagesize and linesize default is - 1.  By default, the spreadsheet is free for formatting output script as he wishes.  If you have not changed these settings in the spreadsheet, then see if you point to a startup script in Tools > Preferences > Database > name of the connection startup script file

    Kind regards

    Gary

    SQL DeveloperTeam

  • Limit the number of CMIS query results

    Hello
    Can we limit the number of CMIS query results
    my query is
    SELECT * from ora: t:IDC:GlobalProfile WHERE the ora: p:xRegionDefinition AS \'ALERTRD\'
    I want only newer 2 alerts to display.

    Thank you

    You use the CMIS query in a workflow of presenter content in WebCenter Portal? These documents provide a maxResults parameter to set.

Maybe you are looking for

  • When I opened a new tab, I get a grid of links. How can I bring this grid to the top on a tab, I already opened?

    If I'm on some URL like google, but I want to see my links, my current method is to open a new tab, and's. But how I make it appear that the matrix of links on, say, the tab of google, I opened? I searched 'new tab' page mozilla shortcut and empty ca

  • Satellite A50 101: extended warranty Toshiba

    I have the Toshiba Satellite A50-101. I read in a manual that I could get 2 years warranty, if I register for extended warranty. I signed it and now I want to know if everyhting is ok. I find a webpage inside Toshiba site where I could check the kind

  • Refusal of connection connection to 9146

    I'm trying to access the modules in an expansion chassis RIO 9146 using the customized by Veristand scanner device. I get an error 307853 that is denied by the login server. I removed my custom device and settings only on an empty project I is the op

  • How to remove files from a library?

    Is it possible to extract individual files from a library?  I downloaded a driver by a hardware manufacturer, but the files are all grouped together in a library.  The screws were created with an older version of LabView and I did not need all the. 

  • USB mouse

    Hello! I really need help here! I am trying to use my mouse as a motion detector... I said it is stupid, but... I WANT TO DO! I want to take his 'motion sensor' and place it near the door and... When the door opens the sensor becomes 'active '... I g