How to reach the output of two or more queries?

Suppose a query:
select count (id) COL1 from table_1 gives:
COL1
59
and another request:
select count (id) COL2 from table_2 gives:
COL2
23
.
HOW can I get this output:
Col1 COl2
59 23
edited by: "bootstrap" October 14, 2011 14:08

Get each count in the subquery:

SELECT
    (
        SELECT
            COUNT(*)
        FROM
            job
    ) AS cnt_job,
    (
        SELECT
            COUNT(*)
        FROM
            department
    ) AS cnt_department
FROM
    dual;

CNT_JOB                CNT_DEPARTMENT
---------------------- ----------------------
51                     4                      

Tags: Database

Similar Questions

  • How to make the output of the task are an entry in another task

    How to connect the output of a task for I can use it as input for another task?  See this screen below: the task "Invoke the Script" run a PowerShell Script.  The task 'Send E-mail' send an email.  The two tasks work separately.  How can I get the results of my powerShell script that I can use them as content of the task 'Send Email'?

    workflow.jpg

    On the script invoke task you set the attributes of output containing the results of powershell.

    to do this, select the output tab and use an object name that was put in place in powershell results as in the data

    You may need to format, this results in a recognized VMware object I guess in your case it is a string type.

    and then select the e-mail task, select the task from email, click on the small eye looking for icon "view details".

    Select the Visual link

    Select the attributes you setup from the output of the previous task and hang it in the input parameters of the task to email.

    fact

  • How to compare the content of two Wordpad / documents notebook without reading them line by line?

    How to compare the content of two Wordpad / documents notebook without reading them line by line?

    Hello

    Without this feature is included in the operating system.

    However, you can use your favorite search engine to look for software that needs to perform these tasks.

    WARNING of THIRD PARTY SOFTWARE: Using third-party software, including hardware drivers can cause serious problems that may prevent your computer from starting properly. Microsoft cannot guarantee that problems resulting from the use of third-party software can be solved. Software using third party is at your own risk.

    Hope this information helps.

  • How to reach the size of the original screen?

    Original title: hot to remove the shadow on the grid.

    my screen is enlarged... How to reach the original size of the screen... Please tell me...

    Hello

    First of all, if it's just a window where the screen is enlarged, use the CTRL and minus (-) keys to zoom out.

    If it is the whole of the screen, adjust the resolution in the settings/personalize/display of the control panel. If you cannot reduce the resolution to a point you could previously, then you will probably to reinstall or update your display adapter drivers.

    Good luck, Rick Rogers, aka "Crazy" - Microsoft MVP http://mvp.support.microsoft.com Windows help - www.rickrogers.org

  • concatenate the output of two sqls.

    Hi all

    I'm trying to concatenate the output of two sqls

    It should be fairly simple, but somehow I find it hard today.

    Here's the sql code.

    < code >

    Select (select to_char (sysdate, 'YYYYMMDD') of double) | "| (select the CHILD_SEQ.nextval of the double) of the double

    < code >

    I'm working on Oracle 11 g.

    Kindly help.

    use

    What's the problem with just doing...

    SQL > create the sequence child_seq;

    Order of creation.

    SQL > ed
    A written file afiedt.buf

    1 * select to_char (sysdate, 'YYYYMMDD') | The double CHILD_SEQ.nextval
    SQL > /.

    TO_CHAR (SYSDATE, 'YYYYMMDD') | CHILD_SEQ. NEXTVAL
    ------------------------------------------------
    201408131

    SQL >

    I hope you're not uing a primary touch well and trying to 'reset' the sequence every day.  This is not recommended and not scalable; keep primary keys simple by simply using a sequence and treat sysdate as a piece of data and other data.  If you need to get "sequences" for a particular day you can create them on the fly using row_number() over (partition by primarykeycolumn order datecolumn) where your datecolumn is the cut off date (trunc (sysdate)) and the primary key column is just the value of sequence assigned to the record.

  • How to install the output in bridge CC module using an apple OSX 10.9.5 and a miss apple OSX 10.11 this point completely in CC bridge!

    How to install the output in bridge CC module using an apple OSX 10.9.5 and a miss apple OSX 10.11 this point completely in CC bridge!

    Hi abev41080082

    Greetings.

    Concerning

    Rohit

  • How to reach the BIOS in Fusion 5

    MacBook 13 "(early 2008), Intel Core 2 Duo, Lion, Fusion 5, Windows 8 Pro"

    Hello

    I want to open the BIOS settings to see for a PXE network boot option.

    In Guide´and User´s Food Guide beginners I can't find, how to reach the BIOS at startup of Fusion.

    What should do?

    czer27

    As it shows on the screen of the virtual machine, you enter the BIOS by pressing F2 or select the Start Menu by pressing the ESC key.  You must click in the display for it to accept input from the keyboard.  In addition on a MacBook you will also need to press the fn key at the same time with the F2 key depending on how you have preferences in OS X keyboard.

    Take a look on: access the BIOS when the MESSAGE screen cleared too quickly (1004129)

    BTW, you are in the VMware Workstation forum and in the future for VMware Fusion you should post in VMware Fusion® (for Mac).

  • How to calculate the sum of two digital form fields based on the selection of the checkbox.

    I have a form in Acrobat Pro who needs a custom calculation. How to calculate the sum of two digital form fields based on a selection of the checkbox. I have three number fields. Field-A and B are simple one or two digits. Field-C is the sum, or the total field. I want to field-C have a control box which, when turned on and off, just gives a. gives the sum of A + B

    _ Field - 2

    _ Field - A 4

    [check] _ _ field - 6 C

    [disabled] _ _ field - 2 C

    Thank you

    The custom field C calculation script could be:

    (function () {
    
        // Get the values of the text fields, as numbers
        var v1 = +getField("A").value;
        var v2 = +getField("B").value;
    
        // Set this field's value based on the state of the check box named "CB"
        if (getField("CB").value !== "Off") {
            event.value = v1 + v2;
        } else {
            event.value = v1;
        }
    
    })();
    

    Replace 'A', 'B', and 'CB' with the real names of the fields.

  • How to store the output of a statement select * statement in a file?

    How to store the output of a statement select * / statement of dsc in a file?

    As user sys:

    CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
    /
    GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
    /
    

    As myuser:

    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                         ,p_dir IN VARCHAR2
                                         ,p_header_file IN VARCHAR2
                                         ,p_data_file IN VARCHAR2 := NULL) IS
      v_finaltxt  VARCHAR2(4000);
      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;
      v_fh        UTL_FILE.FILE_TYPE;
      v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
    BEGIN
      c := DBMS_SQL.OPEN_CURSOR;
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      d := DBMS_SQL.EXECUTE(c);
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
        END CASE;
      END LOOP;
      -- This part outputs the HEADER
      v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
      FOR j in 1..col_cnt
      LOOP
        v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
      END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
      UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      IF NOT v_samefile THEN
        UTL_FILE.FCLOSE(v_fh);
      END IF;
      --
      -- This part outputs the DATA
      IF NOT v_samefile THEN
        v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
      END IF;
      LOOP
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        EXIT WHEN v_ret = 0;
        v_finaltxt := NULL;
        FOR j in 1..col_cnt
        LOOP
          CASE rec_tab(j).col_type
            WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
            WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                        v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                        v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          ELSE
            v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
          END CASE;
        END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
        UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      END LOOP;
      UTL_FILE.FCLOSE(v_fh);
      DBMS_SQL.CLOSE_CURSOR(c);
    END;
    

    This allows the header line and the data to write into files separate if necessary.

    for example

    SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
    
    PL/SQL procedure successfully completed.
    

    Output.txt file contains:

    empno,ename,job,mgr,hiredate,sal,comm,deptno
    7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
    7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
    7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
    7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
    7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
    7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
    7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
    7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
    7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
    7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
    7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
    7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
    7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
    7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10
    

    The procedure allows for the header and the data to separate files if necessary. Just by specifying the file name "header" will put the header and the data in a single file.

  • How to synchronize the analog input and the output of two different USB data acquisition boards

    Hi all

    I have two tips very different USB NI USB 6008 case, which I use to acquire the data (analog input) and a USB of NI 9263 is a output analog only site I use to route a signal (in this case a square pulse). The reason why I use the outputs analog 6008 is because I need to deliver negative tension and need the full +/-10 v range.

    Looking at similar positions, I'm pretty sure that I can't use an external trigger or a common clock, I also tried to use the timed synchronization of the structures but no cigar.

    I'm including a quick vi I whipped showing how the jitters because of the lack of synchronization signal. The OD of the 9263 connects to AI in the 6008 in this example.

    I talked to a specialist in the phone and tols me that's not possible.

  • How to set the output of the report to the session variable

    Hello
    Is it possible to output report to the session variable value. If my report returns 1 row and 1 column.

    I have a dashboard command prompt where I select name, but I want to find the ID of the same name.
    This ID I want to move to a Fx column, to achieve this, I created an interim report and I got the code. Now my problem is how do I put this ID in the session variable.

    Please help if anyone knows...

    Have you read this:
    How to set the session / presentation in the repository variable variable

    Dashboard invites on Month Name but the report on the ID of the month filter:
    Re: Guest dashboard on the name of the month but the report on the necessary month ID filter

    If you have dashboard guest (name), then you can have that one report that is filtered by a name but present card to display or not id but use id in the service. Or two reports as in the solution in the second link above and the second report has id in the function and filter by the id of the first report. You need not define this ID in the session for this example variable.

    Please close your previous discussions, if they are treated.

    Concerning
    Goran
    http://108obiee.blogspot.com

  • How to make the output of Sql Plus with an error Code

    Dear members,

    How can I define sql more exit with an error code.

    We have a simultaneous host program. The executable is a shell script for this program. This sql script Shell script request which in turn gives call to a custom database package that I built.

    The flow rate is:


    -> SQL-> CUSTOM PACKAGE SCRIPT SHELL SCRIPT

    Custom package has two PARAMETERS of the error indicator and the error message. If something fails in the package these two PARAMETERS is returned with a value.

    So my sql script code looks like this:

    WHENEVER SQLERROR EXIT 251
    WHEN the OSERROR EXIT 251
    Set serveroutput size 1000000
    set linesize 32767
    set verify off
    set the position
    Set feedback off

    DECLARE
    x_error_message VARCHAR2 (1000);
    x_sql_message VARCHAR2 (1000);
    x_exception EXCEPTION;
    e_value NUMBER;

    BEGIN
    dbms_output.put_line ('Inside sql file');


    XXpackage.xxproc (x_error_message, x_sql_message);


    IF (x_error_message IS NOT NULL) AND (x_sql_message IS NOT NULL) THEN
    RAISE x_exception;
    END IF;


    EXCEPTION
    WHEN X_EXCEPTION THEN
    e_value: = 1;
    DBMS_OUTPUT. Put_line (' Exit Code: ' | e_value);
    DBMS_OUTPUT. Put_line ('X_EXCEPTION: EXCEPTION IN SCRIPT xpoext04a.sql :'||) SQLERRM);
    DBMS_OUTPUT. Put_line ('x_error_message is: ' | x_error_message);
    DBMS_OUTPUT. Put_line ('x_sql_message is: ' | x_sql_message);
    DBMS_OUTPUT. PUT_LINE (' ERROR IS: ' |) SQLERRM);
    WHILE OTHERS THEN
    e_value: = 252;
    DBMS_OUTPUT. Put_line (' Exit Code: ' | e_value);
    DBMS_OUTPUT. Put_line (' OTHER: EXCEPTION IN SCRIPT xpoext04a.sql :'||) SQLERRM);
    DBMS_OUTPUT. Put_line ('x_error_message is: ' | x_error_message);
    DBMS_OUTPUT. Put_line ('x_sql_message is: ' | x_sql_message);
    DBMS_OUTPUT. PUT_LINE (' ERROR IS: ' |) SQLERRM);


    END;
    */*
    output
    */*


    As you can see from above, if the two PARAMETERS have value, then it goes to an exception.

    My problem is that if it goes with the exception of X_EXCEPTION, the sql is not come away with a mistake. I mean sql is not treat this case like a sqlerror.


    How can do us more sql dating a sqlerror so that the host program must fail.


    Thank you
    Sandeep

    Published by: user340 on July 28, 2009 12:51

    Published by: user340 on July 28, 2009 12:57

    the plu sql is not come away with a mistake. I mean sql is not treat this case like a sqlerror.

    This is because there is no error. You handled the exception.

    You can try adding a STIMULUS; at the end of your exception section. This re-triggers the exception so sql liked to see it.

  • How to set the output meter channel to generate a signal pulse using DAQ6008

    Hello there I am generating a pulse signal of 100 Hz and a duty of 20% of the 6008 data acquisition cycle using visual studio 2013. I have code that needs to generate this but I'm not sure on how to set the channel output meter. When I run this NI MMAX and my vb error code indicates that the physical channel is not supported. I am a user of data acquisition were first and would appreciate any help offered.

    If you look at the USB-6008/6009 User Guide and specifications, you will see that the counter in these devices cannot rely as edges of entry. It cannot generate a pulse.

    Lynn

  • How to control the output voltage?

    Good time after some time can get the output voltage, but this value is alwayscontinuous. How to control the voltage output through a Boolean? In

    in order to get this tension when I want to.

    Greetings.
    Hugo Santos

    Hi Hugo,.

    If you use a LabVIEW project, you must set the time of sampling in the properties of the node (see SamplingInterval.png). But this time to refresh the data should be high enough. If you take into account this update of time trying to control your way out.

    Kind regards

  • How to configure the outputs voltage NI 9477

    Hello

    I'm trying to control a motor using a cRIO 9074 with the NI 9477 module. I would like to configure the output voltage of the module and if I understand correctly, they vary between 5 to 60 v.

    How can I have a 24 v output?

    Thank you.

    JaneDoe94 wrote:

    So if I understand correctly, I can use an exit as a switch?

    If I choose resistance pull-up so the current stay under 1A, would this work?

    For example, I am using R = 20 kOhm and DC = 24V. I need to stay below 5mA current.

    9477 module is basically a relay to connect to the Earth.  But beware of your voltage and current limits.  The maximum current that can flow is 0.625 A by line.  So make sure that you stay below that.

Maybe you are looking for

  • Pavilion x 360: HP Pavilion x 360 stops suddenly

    Hello! So I tried to find a solution to my x 360 laptop. Yesterday, while I was typing in microsoft word for some school projects, she suddenly stops. I thought it ran out of battery, but I remember perfectly that it was fully charged! But I tried to

  • Re: Satellite A200-237 ETA-6 with Windows XP

    Hi ppl, My name is Sibbe and I am from Holland and here again.A few months ago, I bought the Satellite A200-237, distributed initially with Windows Vista. I really enjoyed working with Vista, but everyone knows that Vista slows down your system. Also

  • AVT Guppy 033 B device is the same image twice on the &lt; Session Out &gt; event: Frame made

    Sometimes the event gets the same image twice, but with an increase, correct the image of the index (see photo index 125, 126). We use a type AVT Guppy 033 B firewire camera to measure the distance between plants. The camera fires all 40mm the breakp

  • Telephone links through Filemaker Pro

    Im trying to dial out on my model to a telephone line. IM using filemaker pro as a manager of contacts and through my head piece, I want to be to click and call my client against the composition on a traditiaonl phon

  • HP DV9230US: Difficulty finding features HP. for my laptop

    Problems on the site Web HP find my specs for my laptop which is locking up on me. I am looking for the motherboard type and manufacturing and hard drive info. A previous post was answered by someone who said that I had to replace the hard drive. Of