SQL query returns no row vs. multiple lines

Hello

I am trying to get the result of a simple sql query,
If there is no row returned, he would have "No. ROWS" in the result set.
Other wise all the rows containing data is necessary.

Let me know how this could be achieved. Under query works for the latter and not first case as mentioned below

OUTPUT

+ (box 1) when we use B_ID = 123456 +.

IDS
-----
'NO LINE '.

+ (box 2) when we use B_ID = 12345 +.
IDS
-----
1 11112345
2 22212345
create table TEMP_AAA
(
  A_ID VARCHAR2(10),
  B_ID VARCHAR2(10)
)

INSERT INTO TEMP_AAA(A_ID,B_ID) VALUES('111','12345');
INSERT INTO TEMP_AAA(A_ID,B_ID) VALUES('222','12345');
INSERT INTO TEMP_AAA(A_ID,B_ID) VALUES('333','12000');
INSERT INTO TEMP_AAA(A_ID,B_ID) VALUES('444','10000');
WITH 
MATCH_ROWS AS
(
       SELECT A_ID||B_ID IDS FROM TEMP_AAA WHERE B_ID=12345
),

MATCH_ROW_COUNT AS
(
       SELECT COUNT(1) AS COUNTS FROM MATCH_ROWS
),

PROCESSED_ROWS AS
(
       SELECT
             CASE WHEN COUNTS = 0
                  THEN 
                   (SELECT NVL((SELECT IDS FROM TEMP_AAA WHERE B_ID=12345),'NO ROWS') IDS FROM DUAL)
                  ELSE
                   MATCH_ROWS.IDS
             END IDS     
        FROM MATCH_ROWS,MATCH_ROW_COUNT
)

SELECT * FROM PROCESSED_ROWS;

Hello

I think you want to put this on a report or something. I have what would be easier to do this logic there. But if you want that this is possible.
Like this

with
temp_aaa as
(select '111' a_id ,'12345' b_id from dual union all
select '222'      ,'12345'  from dual union all
select '333'      ,'12000'  from dual union all
select '444'      ,'10000'  from dual
)
, wanted_rows as
( select  '123456' B_ID from dual)
select
  temp_aaa.A_ID || temp_aaa.B_ID IDS 

from
  temp_aaa
  ,wanted_rows
where
  temp_aaa.b_id = wanted_rows.b_id
union all
select
  'NO ROWS'
FROM
  DUAL
WHERE
  (SELECT COUNT(*) FROM TEMP_AAA, wanted_rows WHERE TEMP_AAA.B_ID = wanted_rows.B_ID) = 0

In addition, you mix var and number of always use the same type or convert explicitly (to_number or to_char)

WITH
MATCH_ROWS AS
(
       SELECT A_ID||B_ID IDS FROM TEMP_AAA WHERE      B_ID           =12345
--                                                    varchar2(10)   number
),
...

And again in the

                  THEN
                   (SELECT NVL((SELECT IDS FROM TEMP_AAA WHERE B_ID           =12345),'NO ROWS') IDS FROM DUAL)
--                                                             varchar2(10)   number

Kind regards

Peter

Tags: Database

Similar Questions

  • SQL query returning no rows, please help!

    I have a table that contains the user checks for a specific procedures alongwith the date stamp. Now, I want the list of all procedures that are not accessible by users in the last 6 months. Or, all of the procedures that have not been used/accessible during the last 6 months.

    That's what I'm trying, but is does not return all rows:

    SELECT DISTINCT proc_name,
    TRUNC (entry_date)
    OF log_web
    WHERE NOT IN (SELECT proc_name proc_name
    OF log_web
    WHERE TRUNC (entry_date) > TRUNC (SYSDATE - 180))
    ORDER BY DESC 2

    Please notify.
    Thank you in advance.

    Hello

    NOT IN never returns TRUE if the subquery returns NULL values. If proc_name doesn't have a NOT NULL constraint, change the subquery to

    WHERE        proc_name     NOT IN ( SELECT  proc_name
                                FROM      log_web
                         WHERE      entry_date     > TRUNC (SYSDATE - 180)
                         AND      proc_name     IS NOT NULL
                          )
    

    I don't see any other suspect.
    Post a small example of data (CREATE TABLE and INSERT statements) where the query produces results worng.

  • If a view object query returns no rows, can the vacuum to be tested at all?

    All those who know or have also experienced:

    I guess that the answer should be Yes, but I tried anyway, I still didn't worked. Here is the code (it's a method behind a command button, a bean of support (I use JDeveloper 10.1.3.4).) In the code, LoggedInStudent is the name of a view object; ZBLCModule is the name of the application module):
        public String commandButton1_action() {
            FacesContext fc = FacesContext.getCurrentInstance();
            ValueBinding vb = fc.getApplication().createValueBinding("#{data}");
            BindingContext bc = (BindingContext)vb.getValue(fc);
            DCDataControl dc = bc.findDataControl("ZBLCModuleDataControl");
            ApplicationModule am = (ApplicationModule)dc.getDataProvider();
            ZBLCModuleImpl zblcam = (ZBLCModuleImpl)am;
            LoggedInStudentImpl studentsFound = (LoggedInStudentImpl)zblcam.getLoggedInStudent();
            
            String navCase = null;
            
            // Test (1): if the view cache is empty; always bombs up the application if it IS empty:
            if(studentsFound.getAllRowsInRange().length == 0) {
                navCase = "userNotFound";
            // (2) The following three tests gets to run only when the cache is not empty; they work fine.
            } else if (((Number)studentsFound.first().getAttribute("HoursAttm")).floatValue() == 0.0) {
                navCase = "noHours";
            } else if (((Number)studentsFound.first().getAttribute("Balance")).floatValue() > 0.0) {
                navCase = "notZero";
            } else if (!(studentsFound.first().getAttribute("Validated").equals(" "))) {
                navCase = "validated";
            } else {
                navCase = "zeroBal";
            }
            return navCase;
        }
    When the view object query returns a line, the whole of the application works without error. When the query returns no rows, test (1) always bombs toward the top of the application, prompting a Houston-30003 error.

    (1) test, I tried the following:
      if (studentsFound.getAllRowsInRange().length == 0)
      if (studentsFound.first() == null)
      if (studentsFound.getEstimatedRowCount() == 0)
      if (studentsFound.isDead()) //I do not know what isDead() does; just tried desperately.
      if (studentsFound.equals(null))
      if (studentsFound.getCurrentRow() == null)
    With each of these events, I got an error of Houston-30003. It does not matter what looks like the conditional test; It is important only when the objects from view cache is empty. If the view cache is not empty, everything, including the test (1), works very well. And when the cache is empty is not because of the failure of the connection to the database, but because the student is not in the data table and line are for the student.

    It is a requirement of the company to do something when the view object query returns no rows. Can it be tested at all? How?

    Or is there something wrong in the first lines in the method before the {color: green} String navCase = null; {color} line?

    Thank you very much for your help!


    Newman

    Hello

    What you have done, is to get a handle to the object that CAN execute queries to the database.
    However, you do not query the database.

    Just add:

      LoggedInStudentImpl studentsFound = (LoggedInStudentImpl)zblcam.getLoggedInStudent();
      //New line
      studentsFound.executeQuery();
    

    The code that Shay has given you is when you do not have a request for all module, but since you are talking about a command etc button I guess that the module of the application is already active.
    The line I gave you should be enough to make it work.

    I'd be careful with the

    studentsFound.hasNext();
    

    I suggest to use estimatedRowCount();

    -Anton

  • Oracle Text multi column index based query returns no rows

    Hello

    I have a MAH_KERESES_MV table with 3 columns OBJEKTUM_NEV, KERESES_SZOVEG_1, KERESES_SZOVEG_2. I create the following Oracle multi column text index:

    ctx_ddl.create_preference exec ('MAH_SEARCH', 'MULTI_COLUMN_DATASTORE');
    ctx_ddl.set_attribute exec ('MAH_SEARCH', 'COLUMNS', 'OBJEKTUM_NEV, KERESES_SZOVEG_1, KERESES_SZOVEG_2');

    create index MAX_KERES_CTX on MAH_KERESES_MV (OBJEKTUM_NEV)
    indexType is ctxsys.context
    parameters ("DATASTORE MAH_SEARCH");
    But the query returns no rows, although if I make the query with the 'like' operator, and then I get the results as expected:

    SELECT id, OBJEKTUM_NEV
    OF MAH_KERESES_MV
    WHERE CONTAINS (OBJEKTUM_NEV, "C") > 0;

    Can some body please help? TIA,

    Tamas

    You can do it in Oracle Text, well it is not necessarily desirable.

    You can search the

    WHERE CONTAINS(OBJEKTUM_NEV, '%C%')>0;
    

    And it will probably work in a simple test. However, using a leader like this wildcard prevents them the index on the table "list of words" used, so such a request can be very slow on a large system.
    You can improve this by using SUBSTRING_INDEX, but making your much bigger index. And you could always hit the 'expansions too' problem if %C % expansion is more than about 15,000 words (depending on version and different settings).

    Also be aware of differences in case - %C % will match 'fact' or 'FACT', as part of a CONTAINS, but not part of a TYPE.

  • Stupid old backpacker (me) cannot understand why this query returns 1 row

    Hi all

    In reference to {: identifier of the thread = 2456973}, why do
    select sum(count(decode(job, 'CLERK', 1, null))) CLERKS
    , sum(count(decode(job, 'SALESMAN', 1, null))) SALESMANS
    from emp group by job;
    only 1 rank and not 1 for each task? In fact, I had to test it myself to believe.

    It returns the data as if the query were
    select sum(CLERKS), sum(SALESMANS)
    from (select count(decode(job, 'CLERK', 1, null)) CLERKS, count(decode(job, 'SALESMAN', 1, null)) SALESMANS
             from emp group by job)
    Using only a single aggregate (count or sum) returns 1 row per job, as expected

    John Stegeman wrote:
    It returns the data as if the query were

    select sum(CLERKS), sum(SALESMANS)
    from (select count(decode(job, 'CLERK', 1, null)) CLERKS, count(decode(job, 'SALESMAN', 1, null)) SALESMANS
    from emp group by job)
    

    Exactly the point ;-)

    It seems that Oracle actually do, a group of 'double' in the same operation.
    Attend plans to explain in this example:

    SQL> select count(decode(job, 'CLERK', 1, null)) CLERKS
      2       , count(decode(job, 'SALESMAN', 1, null)) SALESMANS
      3  from scott.emp group by job;
    
        CLERKS  SALESMANS
    ---------- ----------
             0          0
             0          0
             0          0
             0          4
             4          0
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1697595674
    
    ---------------------------------------------------------------------------
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |      |     5 |    40 |     4  (25)| 00:00:01 |
    |   1 |  HASH GROUP BY     |      |     5 |    40 |     4  (25)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| EMP  |    14 |   112 |     3   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    

    And compare it to the one with the double aggregates:

    SQL> select sum(count(decode(job, 'CLERK', 1, null))) CLERKS
      2       , sum(count(decode(job, 'SALESMAN', 1, null))) SALESMANS
      3  from scott.emp group by job;
    
        CLERKS  SALESMANS
    ---------- ----------
             4          4
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 417468012
    
    ----------------------------------------------------------------------------
    | Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ----------------------------------------------------------------------------
    |   0 | SELECT STATEMENT    |      |     1 |     8 |     4  (25)| 00:00:01 |
    |   1 |  SORT AGGREGATE     |      |     1 |     8 |     4  (25)| 00:00:01 |
    |   2 |   HASH GROUP BY     |      |     1 |     8 |     4  (25)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL| EMP  |    14 |   112 |     3   (0)| 00:00:01 |
    ----------------------------------------------------------------------------
    

    There are GROUP BY hash and SORT GLOBAL times.

    It is really unnecessary to an aggregate on an aggregate - if two aggregates are used "in the same group level.
    Sum() aggregates are used on an already aggregated value, so it doesn't look like Oracle which actually cures like 'first do the internal aggregate using the group specified by and then do the external aggregation on the result with any group.'

    Look at this example where I combine aggregates "double" with "single" aggregates:

    SQL> select sum(count(decode(job, 'CLERK', 1, null))) CLERKS
      2       , sum(count(decode(job, 'SALESMAN', 1, null))) SALESMANS
      3       , count(decode(job, 'SALESMAN', 1, null)) SALESMANS2
      4       , count(*) COUNTS
      5  from scott.emp group by job;
    
        CLERKS  SALESMANS SALESMANS2     COUNTS
    ---------- ---------- ---------- ----------
             4          4          1          5
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 417468012
    
    ----------------------------------------------------------------------------
    | Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ----------------------------------------------------------------------------
    |   0 | SELECT STATEMENT    |      |     1 |     8 |     4  (25)| 00:00:01 |
    |   1 |  SORT AGGREGATE     |      |     1 |     8 |     4  (25)| 00:00:01 |
    |   2 |   HASH GROUP BY     |      |     1 |     8 |     4  (25)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL| EMP  |    14 |   112 |     3   (0)| 00:00:01 |
    ----------------------------------------------------------------------------
    

    When you mix "doubles" and "single" aggregates, Oracle decides that unique aggregates belong to the 'outer' aggregation
    SALESMAN2 did a count on the aggregated work column which is the result of the 'internal' group by - so only 1.
    The count (*) is also the result of the aggregation of the 'internal '.

    I don't know if it's documented or if it is an 'effect' of internal code used for GROUPING SETS or the internal code used to enable the analytical functions like this:

    SQL> select count(decode(job, 'CLERK', 1, null)) CLERKS
      2       , count(decode(job, 'SALESMAN', 1, null)) SALESMANS
      3       , sum(count(decode(job, 'CLERK', 1, null))) over () CLERKS2
      4       , sum(count(decode(job, 'SALESMAN', 1, null))) over () SALESMANS2
      5  from scott.emp group by job;
    
        CLERKS  SALESMANS    CLERKS2 SALESMANS2
    ---------- ---------- ---------- ----------
             0          0          4          4
             4          0          4          4
             0          0          4          4
             0          0          4          4
             0          4          4          4
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 4115955660
    
    ----------------------------------------------------------------------------
    | Id  | Operation           | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ----------------------------------------------------------------------------
    |   0 | SELECT STATEMENT    |      |     5 |    40 |     4  (25)| 00:00:01 |
    |   1 |  WINDOW BUFFER      |      |     5 |    40 |     4  (25)| 00:00:01 |
    |   2 |   SORT GROUP BY     |      |     5 |    40 |     4  (25)| 00:00:01 |
    |   3 |    TABLE ACCESS FULL| EMP  |    14 |   112 |     3   (0)| 00:00:01 |
    ----------------------------------------------------------------------------
    

    Personally, I think that I would have preferred if Oracle has raised an error on this "double aggregation" and therefore require me to write this way (if it's the result I wanted):

    select sum(CLERKS), sum(SALESMANS)
    from (select count(decode(job, 'CLERK', 1, null)) CLERKS, count(decode(job, 'SALESMAN', 1, null)) SALESMANS
             from emp group by job)
    

    I don't really see a good use case for aggregations of 'double'-, but rather that he could give you undetected bugs in your code, if you happen to do double aggregation without noticing.

    Interesting thing to know ;-)

  • SQL query - only unique rows back

    Hello

    If you have an employee table, where employees are listed by Department, using SQL, could return you the names of the employees listed by Department on one single line?

    EG - select deptno, employee first name

    DEPTNO name
    10 Jane
    Jack 20
    10 Joe
    Jill 20
    Jacinta 10
    30 John
    Jeffrey 30
    10 Jackie
    Jennifer 30
    ... etc.


    the return set of the query might look like:

    Concat name DEPTNO
    Jane 10 Joe Jacinta Jackie...
    20 shooting Jill...
    30 John Jeffrey Jennifer...

    See you soon

    or use the LISTAGG function

    WITH T AS
    (SELECT 10 deptno, 'Jane' first_name FROM dual UNION
     SELECT 20 deptno, 'Jack' first_name FROM dual UNION
     SELECT 10 deptno, 'Joe' first_name FROM dual UNION
     SELECT 20 deptno, 'Jill' first_name FROM dual UNION
     SELECT 10 deptno, 'Jacinta' first_name FROM dual UNION
     SELECT 30 deptno, 'John' first_name FROM dual UNION
     SELECT 30 deptno, 'Jeffrey' first_name FROM dual UNION
     SELECT 10 deptno, 'Jackie' first_name FROM dual UNION
     SELECT 30 deptno, 'Jennifer' first_name FROM dual)
    SELECT   DEPTNO, LISTAGG(first_name,' ') within GROUP (order by deptno)
    FROM     T
    group by DEPTNO
    
  • reload the page when SQL query returns a value

    Hello world

    the title of this discussion may seem strange, but I'll try to explain why I need this:

    A user has the ability to connect on my APEX application. There are several tabs in my application that are visible only if a certain SQL statement returns a value which is not the case by default. The user has also the ability to download a file that is transferred to an external system that analyzes the file and writes the data in the database. During this writing process - which may take several minutes - conditions for some of the tabs to show the will becomes real (-> the query will return a value). When the user refreshes the page manually, the tabs will be displayed. However, I want the tabs will appear automatically when the condition is met.

    Is it possible to refresh the page as soon as the query returns a value? It is perhaps possible to check it on the client side and trigger a refresh of the page when the condition is met. It would be even better if only the tabset has been updated, but refreshing the full page is fine as well.

    Thank you!

    Here is an overview of how it can be done

    This is possible thanks to a dynamic action being performed on a timer.

    View default tabs and dynamic action hide them on loading the page if they are not to be considered

    Create a dynamic action that will execute your query every 5 seconds or more

    If the query returns data, you can use the dynamic action to show your tabs using javascript

  • Attributes XML makes my query returns no rows

    Hi all

    I have a strange problem.

    I ask an XML, but the attributes in one of the tags my query will return no rows. If I delete the attributes, the query works as expected.

    The XML code is below; This is the Report tag attributes that cause problems:
    <result errorCode="0">
         <return>
              <Report
                   xsi:schemaLocation="Items_x0020_status_x0020_information http://******-****/ReportServer?%2FReports%2FContent%20Producer%20Reports%2FItems%20status%20information&amp;rs%3AFormat=xml&amp;rc%3ASchema=True"
                   Name="Items status information" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns="Items_x0020_status_x0020_information">
                   <Tablix1>
                        <Details_Collection>
                             <Details ItemId="914P7" Username="test" user_role="IT"
                                  first_name="Barry" last_name="Donovan" organisation=""
                                  content_format="On_Screen" modified_date="26/05/2011 13:16:49"
                                  item_status="Draft" status_date="" component_name="" demand="" />
                        </Details_Collection>
                   </Tablix1>
              </Report>
         </return>
    </result>
    My query is:
         select
                a.item_id
               ,a.username
               ,a.user_role
               ,a.first_name
               ,a.last_name
               ,a.supplier_id
               ,a.format
               ,a.modified_date
               ,a.item_status
               ,a.completion_date
               ,a.component_code
    
             from   dual
                   ,xmltable
                    ('/result/return/Report/Tablix1/Details_Collection/Details'
                       passing p_xml
                       columns
                          item_id         varchar2(1000) path '@ItemId'
                         ,username        varchar2(1000) path '@Username'
                         ,user_role       varchar2(1000) path '@user_role'
                         ,first_name      varchar2(1000) path '@first_name'
                         ,last_name       varchar2(1000) path '@last_name'
                         ,supplier_id     varchar2(1000) path '@organisation'
                         ,format          varchar2(1000) path '@content_format'
                         ,modified_date   varchar2(1000) path '@modified_date'
                         ,item_status     varchar2(1000) path '@item_status'
                         ,completion_date varchar2(1000) path '@status_date'
                         ,component_code  varchar2(1000) path '@demand'
                    ) a;
    I tried to strip the attributes to the tag, which works, but some XML I look back are large enough (number of records), so that cause problems in itself. I would rather deal with it and don't mess with the XML itself if possible.

    Any help would be much appreciated!

    Thank you much in advance.

    Robin

    Published by: User_resU on April 12, 2012 14:50

    The element of report and its children belong to a default namespace.
    You have stated that in the request too:

    xmltable
    (
    xmlnamespaces('Items_x0020_status_x0020_information' as "ns0"),
    '/result/return/ns0:Report/ns0:Tablix1/ns0:Details_Collection/ns0:Details'
       passing
    
  • 'Function SQL Query return' using with Flash graphics

    I created a pl/sql function that returns a SQL query in a varchar2 of this form:

    Select the null link
    -value > < x value
    < value y of Series1 > series 1 label
    < value Series2 y > 2 series label
    < value of y Series3 > series 3 Label
    ...
    ...
    from tablea a
    Join tableb b
    On a.col = b.col
    order of < x value >

    If I call the function of a graphic Flash box series SQL with the Type of Source query "SQL query" value that returns the function like this:

    return functionname (to_date ('30-sep-2010, ' mon-dd-yyyy ""))

    It parses correctly and the page is saved; However, when I run the page I get no output - error messages or another indication of a problem.

    Now, if I call the function in a SQL client, capture the result of the query SQL using the dbms_output and paste that into the box graphic Flash series SQL - change the Source Type of SQL query query - and save the page it works fine when I run it and returns a chart series flash.

    Can anyone suggest either;

    1. what I might have missed or done wrong?
    2. a way to effectively diagnose the problem...

    I tried to use the debugger Apex - what is very nice, indeed - but it provides no information on what might be my problem. I tried to write my own my function debug messages using the apex_debug_message package - nothing...

    Thank you
    Eric

    Hi Eric,.

    Try to pull the source like this:

    begin
       return functionname(to_date('30-sep-2010', 'dd-mon-yyyy'));
    end;
    

    This works very well for me, and if I take the begin-end and the final semicolon from the return statement I get the same behavior as you.

    He doesn't mention in aid of the source (only during the wizard if) this source type must be expressed in this way, but I agree, it would be useful that the tool would validate to this format meets it "Query SQL that returns the function" or give some sort of indication of the sentence. In any case, this should help you will again.

    Hope this helps,
    John

    If you find this information useful, please do not forget to mark the 'useful' or 'correct' post so that others benefit as well.

  • PL/SQL Query return function, adding the column links

    Hi all

    I'm working on a SQL report with the area type = function from PL/SQL Query to return
    All columns are generated dynamically based on my mapping table and a column of ID.
    So whenever the page is loaded, according to the ID mapping table returns a set of columns in a particular order.
    So not only the columns are dynamic, but the order of the columns varies also.
    But the first 1 column is standard (it doesn't come from the mapping table) and is coded in my pl/sql block hard.

    I'm fighting with the addition of a link to this column. The link must be a Javascript function which takes the parameters in the form of 2 columns in the mapping table.
    My pl/sql block is something like that...
    v_select := 'SELECT <g href=javascript:f_report1(#map_id#,#comments#)><img src=""></a> as report1, ';  // g=a
    v_cols := 'contains all columns from the mapping table based on a ID(hidden item)';
    v_from := 'FROM table';
    v_where := 'where condition is put in here';
    v_query := v_select||v_from||v_where;
    return v_query;
    Now, I'm not able to transmit the values of this #map_id # and #comments # correctly. I tried so many different combinations of channels, but could not make it work.

    I'm not sure that the order of this map_id and commentscolumn and therefore cannot connect through the report attributes.
    How can I go to a column value to the function?



    Thank you
    Dippy

    This should work if all goes well:

    v_select := q'[ SELECT '' as chart, ]';
    

    Published by: Dimitri Gielis on May 20, 2010 20:10

  • User_Scheduler_Jobs query returns no row in the version 2.1.0.63

    Using the 2.1.0.63 version, "select * from user_scheduler_jobs;" returns no rows. It works fine in version 1.5.5.

    Published by: User65423 on February 8, 2010 09:24

    Refer to this topic, when the cause seems to be due to SQL Developer manages not null interval data types.

    bug? F9 gives no output dba_scheduler_jobs, version: 2.1.0.63.73

    As mentioned in this thread, you can use to_char on the columns of the interval as a workaround...

    SELECT source,
    destination,
    comments,
    flags,
    job_name,
    job_creator,
    client_id,
    global_uid,
    program_owner,
    program_name,
    job_type,
    job_action,
    number_of_arguments,
    schedule_owner,
    schedule_name,
    start_date,
    repeat_interval,
    end_date,
    job_class,
    enabled,
    auto_drop,
    restartable,
    state,
    job_priority,
    run_count,
    max_runs,
    failure_count,
    max_failures,
    retry_count,
    last_start_date,
    TO_CHAR(last_run_duration),
    next_run_date,
    TO_CHAR(schedule_limit),
    TO_CHAR(max_run_duration),
    logging_level,
    stop_on_window_close,
    instance_stickiness,
    system,
    job_weight,
    nls_env
    FROM user_scheduler_jobs a;
    
  • SQL query return different result 11 GR 1 material and GR 11, 2

    Problem: SQL returns different results in 11 GR 1 material and GR 11, 2 games.

    Example script:

    create the table tab_main
    (
    SOS number (2) not null,
    contract number (2) null
    )
    /

    create the table tab_sub
    (
    number (2) of contract non-null,.
    SOS number (2) null
    )
    /

    insert into tab_main values (1, 10);
    insert into tab_main values (2, 20);
    insert into tab_main values (3, null);
    insert into tab_main values (4, null);

    insert into tab_sub values (1, 10);
    insert into tab_sub (20, 2) values;
    commit;

    The SQL code:

    SELECT *.
    OF tab_main.
    tab_sub
    WHERE tab_main.sos = tab_sub.sos (+) AND
    tab_main. Contract = tab_sub.contract (+) and
    tab_main. Contract not in (select 1 of the double);

    The above query gives more results
    -by 11.2.0.4
    1 10 10 1
    2 20 20 2

    -in 11.1.0.7
    1 10 10 1
    2 20 20 2
    4
    3


    Please tell us what could be the reason for the behaviour of offset lines thie.


    Thank you

    Piesset

    I think it is probably a bug in 11.1.0.7 (and possibly other versions), I get the same results as your 11.2.0.4 9.2.0.7, 10.2.0.3 and 11.2.0.3, and this is the result, I expect.

    Your not in the paragraph is equivalent to:

    SELECT *.

    OF tab_main, tab_sub

    WHERE tab_main.sos = tab_sub.sos (+) AND

    tab_main. Contract = tab_sub.contract (+) and

    tab_main. Contract <> 1;

    Since you have null values in tab_main.contract they are lost by the predicate since null = value is never true (or false).

    John

  • Large type query returning no rows

    Hello

    Posted in right forum hope eth, I also posted this in SQl & PL/SQL which is not the right forum, I think.

    I'm running a kind of large select query, counties of table is as shown below.

    The lines are not returned which is quite impossible.

    What could be the reason. Tablespace TEMP has run out or optimizer does not?

    My Oracle version: 10 G R/2
    I tried to update the statistics for each table, I am unable to check the TEMP tblspace as am not the ADMINISTRATOR.


    COUNT (*) TABLE IS


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

    13047187

    COUNT (*) TABLE B
    --------------------------------------------------------------------------------

    618194

    COUNT (*) TABLE C
    --------------------------------------------------------------------------------

    18058

    COUNT (*) TABLE D
    --------------------------------------------------------------------------------

    9

    COUNT (*) TABLE E
    --------------------------------------------------------------------------------

    11813966

    COUNT (*) TABLE F
    --------------------------------------------------------------------------------

    18093

    COUNT (*) TABLE G
    --------------------------------------------------------------------------------

    13099

    COUNT (*) TABLE:
    --------------------------------------------------------------------------------

    12000000

    COUNT (*) TABLE I
    --------------------------------------------------------------------------------

    5285
    Anyy help is appreciated

    Seems to me that if the pid is different.
    Select * from where a pid = "ACT714";<-- no="">
    Select * from b where pid = "ACT714";<-- trailing="">

    Try
    Select count (*) of a, b
    where trim (a.pid) = trim (b.pid);

    If it works, you might want to consider how you store data, if they are supposed to be equal.

    Check also if you compare with the data type varchar2, char data type.
    I generally avoid the reasons char data type.

  • Export query returns no rows

    Dear guy,

    I jam with this problem for 2 days and have you guy help me to check it out. Here's my parfile

    TABLES IS UMARKETADM. TRANS_DATA

    CONTENT = DATA_ONLY

    EXCLUDE = STATISTICS

    QUERY = UMARKETADM. TRANS_DATA: "WHERE transid in (select id from umarketadm.trans t where t.last_modified > to_date (5 January 2014 00:00:00 ',' DD/MM/YYYY hh24:mi:ss') and t.state in (2.6))" "

    DUMPFILE = SHARED_DIR:Demand.dmp

    Network_link = remote_db

    and the result is:

    . . exported "UMARKETADM." "" TRANS_DATA ".6,398 KB0 rows

    Main table 'SYSTEM '. "" SYS_EXPORT_TABLE_01 "properly load/unloaded

    But when I check in, select the table:

    Select count (*) in umarketadm.trans_data

    where transid in (select id from umarketadm.trans t where t.last_modified > to_date (5 January 2014 00:00:00 ',' dd/mm/yyyy hh24:mi:ss') and t.state in (2.6));


    then it results in: 1271258 lines

    Yes, is there some things wrong with my parfile?

    So thank you and best regards

    Ch

    Hello

    I think that maybe it's a quirk of how works on network lnk datapump. I think the memory some of the rferences becomes 'local' rather than distance.

    You can try?

    TABLES IS UMARKETADM. TRANS_DATA

    CONTENT = DATA_ONLY

    EXCLUDE = STATISTICS

    QUERY = UMARKETADM. TRANS_DATA: "WHERE transid in (select id from umarketadm.trans@remote_db t where t.last_modified > to_date (5 January 2014 00:00:00 ',' DD/MM/YYYY hh24:mi:ss') and t.state in (2.6))" "

    DUMPFILE = SHARED_DIR:Demand.dmp

    Network_link = remote_db

    See you soon,.

    Rich

  • SQL query: only the numbers in the line of the somme - need help

    Pls see data below. I want to display only 8 lines and lines of BRH NCC should be merged and displayed as - BRH 98 2 instead of 2 rows. The rest of the lines must remain as it is. Help, please.


    NCC SERVICES MANUFACTURING
    ASL 138 NA
    BRH 98 NA
    BRH NA 2
    C10000 NA 0
    C40000 NA 0
    DAO NA 10
    E10000 NA 0
    I10000 NA 0
    M10000 NA 0

    Published by: auxilia on November 7th, 2009 06:25
    with t as (
               select 'ASL' ccn,'138' services,'NA' manufacturing from dual union all
               select 'BRH','98','NA' from dual union all
               select 'BRH','NA','2' from dual union all
               select 'C10000','NA','0' from dual union all
               select 'C40000','NA','0' from dual union all
               select 'DAO','NA','10' from dual union all
               select 'E10000','NA','0' from dual union all
               select 'I10000','NA','0' from dual union all
               select 'M10000','NA','0' from dual
              )
    select  ccn,
            nvl(max(case services when 'NA' then null else services end),'NA') services,
            nvl(max(case manufacturing when 'NA' then null else manufacturing end),'NA') manufacturing
      from  t
      group by ccn
    /
    
    CCN    SERVICES             MANUFACTURING
    ------ -------------------- --------------------
    E10000 NA                   0
    C10000 NA                   0
    BRH    98                   2
    M10000 NA                   0
    C40000 NA                   0
    ASL    138                  NA
    I10000 NA                   0
    DAO    NA                   10
    
    8 rows selected.
    
    SQL>   
    

    SY.

    Published by: Solomon Yakobson on November 7th, 2009 06:46

Maybe you are looking for

  • HP laserjet 1536dnf mfp Windows 10

    After the upgrade to windows 7 to windows 10 fail to launch the application to scan. Where to find driver HP laserjet mfp 1536dnf for windows 10?

  • HP B210a Photosmart: cannot sweep on B210a after update to El capitan

    I have updated to OS X El Capitan and now can not scan to my iMac.  I tried to use HP Easy Scan and Apple Image capture, but they do not work or the other.  What should I do now?

  • DeskJet 1510: Deskjet 1510/stop doubt button

    Hello I set up my new printer correctly and I'm pretty sure that I clicked the power button to turn it off yesterday, but now when I want to turn off again, when you hit the power button, nothing happens. It is not a click and does nothing. There is

  • How to backup and transfer files on HP's Android Tablet

    As with any device that can be used to store important information, having a backup is always a good idea, but also learn to transfer your files between other devices. With the HP's Android tablet, the user has several options when it comes to backin

  • Enable the HTTP Server

    I have a Cisco Aironet 3702E and I want to set it up as a standalone unit in my network. This access point is a brand new and has not been deployed in a network and has not been controlled by a CA previously. I tried to find how to enable HTTP on the