By selecting dates from Friday to Sunday?

Hello people,
Try to work on a request where there is a selection of date in the where clause. That is, if sysdate is Monday, I get the data from Friday to Sunday.
   and sh.change_date >=
               to_date('20110304 000000', 'YYYYMMDD HH24MISS')
           and sh.change_date <=
               to_date('20110306 235959', 'YYYYMMDD HH24MISS')
Am now hard-coding the dates I want to see in the change_date. But is it possible that every time when I run the query didn't change these date values?

Thanks a bunch!

Hello

Thank you. Now that I can test the code I posted, I see that there is a typing error in TO_CHAR arguments.
That's what you want:

DEFINE  test_sysdate = "DATE '2011-03-08'"

SELECT     *
FROM     test_a
WHERE   change_date    >= TRUNC (&test_sysdate) - CASE  TO_CHAR ( &test_sysdate
                                                         , 'Dy'
                                          , 'NLS_DATE_LANGUAGE=ENGLISH'     -- If necessary
                                          )
                                    WHEN  'Mon'  THEN  3
--                                    WHEN  'Sun'  THEN  2
                                                     ELSE  1
                                            END
AND     change_date < TRUNC (&test_sysdate)
;

except that when I used the proxy & test_sysdate above (to make it easy test), you use SYSDATE.

I have commneted on the particular case of when you run the query on Sunday. You probably want is a comment this line or remove it completely.

Tags: Database

Similar Questions

  • How to select data from a remote database table?

    Hi friends,

    I think I've seen before a sqlplus program that can select data from a remote database table?

    Witnessed: IP, SID, PORT

    The following is correct?

    (I am connected to a local database)
    SELECT COUNT (*) IN THE EMP@IP:SID/PORT;


    Thank you very much


    Ms. K

    Salvation;

    I think, that you can create dblink wihtout any problem yet, it's a PROD. After your selection, you can drop dblink

    Respect of
    HELIOS

  • How to export select data from table in the file?

    Hello..

    Here's my query to select data in 2 tables and I join help call_id column: -.

    Select n.nbr_calling, n.nbr_called, c.tec, n.conversation_duration
    of albn_ngnsm_280110 n, albc_ngnsm_280110 c
    where c.call_id = n.call_id
    and c.route_to_arbor = 1;

    The problem is what is the query to export all the output in text files?


    Thank you
    Balleur

    Hello

    set echo off
    set heading off
    set pagesize 0
    set linesize 150
    
    spool D:\file.csv
    SELECT Query
    spool off
    

    Thank you
    Ankur

  • Select data from request date filter

    Here is the example of table with data

    CREATE TABLE test_date (DATE of "CREATED_DATE", "UPDATED_DATE" DATE, NUMBER of 'YEAR'); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('12-JAN-14','DD-MON-RR'),to_date('12-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('13-JAN-14','DD-MON-RR'),to_date('13-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('14-JAN-14','DD-MON-RR'),to_date('14-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('15-JAN-14','DD-MON-RR'),to_date('15-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('16-JAN-14','DD-MON-RR'),to_date('16-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('17-JAN-14','DD-MON-RR'),to_date('17-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('18-JAN-14','DD-MON-RR'),to_date('18-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('19-JAN-14','DD-MON-RR'),to_date('19-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('20-JAN-14','DD-MON-RR'),to_date('20-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('21-JAN-14','DD-MON-RR'),to_date('21-JAN-14','DD-MON-RR'),2009); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('22-JAN-14','DD-MON-RR'),to_date('22-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('23-JAN-14','DD-MON-RR'),to_date('23-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('24-JAN-14','DD-MON-RR'),to_date('24-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('25-JAN-14','DD-MON-RR'),to_date('25-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('26-JAN-14','DD-MON-RR'),to_date('26-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('27-JAN-14','DD-MON-RR'),to_date('27-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('28-JAN-14','DD-MON-RR'),to_date('28-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('29-JAN-14','DD-MON-RR'),to_date('29-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('30-JAN-14','DD-MON-RR'),to_date('30-JAN-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('31-JAN-14','DD-MON-RR'),to_date('12-MAR-14','DD-MON-RR'),2010); Insert into test_date (CREATED_DATE, UPDATED_DATE) values (to_date('01-FEB-14','DD-MON-RR'),to_date('01-FEB-14','DD-MON-RR'),2011);

    This query returns no data

    Select * from test_date where created_date < 31 January 14 ' and updated_date > 31 January 14 ';


    desired result

    above the query should return before last row as well as below

    31 JANUARY 14 MARCH 12, 142010

    I am surprised why above query is not any line? !!!

    Select * from test_date where created_date < '31-jan-14'="" and="" updated_date=""> 31 January 14 ';


    desired result

    above the query should return before last row as well as below

    31 JANUARY 14 MARCH 12, 14 2010

    I am surprised why above query is not any line? !!!

    You do not get the expected results because '<' (less="" than)="" operator="" does="" not="" include="" the="" results="" that="" are="" equal="" to="" the="" right="" hand="" side="" value.="" in="" order="" to="" get="" the="" desired="" result="" change="" the="" comparison="" operator="" to=""><=>

  • read in select data from another table

    Hello world.

    IM Oracle11GR2 database.

    I m facing the following problem:

    I have 2 tables.

    In the first picture, I have a few articles and 3 of these items then come.

    (A) point Varchar2

    (B) Item Varchar2.

    (C) point digital and this point is the id of a record in the other table.

    If the digital point > 0 then points A and B must be read in the second table

    In the second table, I have 3 Articles.

    (A) the id of the record.

    B & C point are also point varchar2 and must be read in the first table, point C is > 0.

    I'm looking for the way that when I write a normal selection in the first picture he gives me the point B & C of the second table if C point in the first table is > 0.

    I thought to solve this problem with a trigger or something similar.

    Any idea is welcome.

    Regards to everyone.

    You don't need a trigger for this. A simple select statement should do. Something like that? I got your if condition perfectly.

    SELECT CASE WHEN (T1. C > 0) THEN (SELECT T2. B OF THE T2 WHERE T1. C = T2. (A) T1 OTHERWISE. END A,

    BOX WHEN (T1. C > 0) THEN (SELECT T2. C FROM T2 WHERE T1. C = T2. (A) T1 OTHERWISE. B END HAVE B,

    T1. C

    FROM T1;

    Look at the following example. Check if it fills your scenario.

    -BEGINNING OF THE SAMPLE DATA

    WITH T1 AS)

    SELECT 'A' A, 'B' B, 1 C OF DOUBLE UNION ALL

    SELECT 'C', ', 2 DOUBLE UNION ALL

    SELECT 'DF', 'G', THE DOUBLE 0),

    () AS T2

    SELECT 1, 'X' B 'Y' C DOUBLE UNION ALL

    SELECT 2, 'Z', 'BB' OF THE DOUBLE)

    -END OF THE SAMPLE DATA

    SELECT CASE WHEN (T1. C > 0) THEN (SELECT T2. B OF THE T2 WHERE T1. C = T2. (A) T1 OTHERWISE. END A,

    BOX WHEN (T1. C > 0) THEN (SELECT T2. C FROM T2 WHERE T1. C = T2. (A) T1 OTHERWISE. B END HAVE B,

    T1. C

    FROM T1;

    OUTPUT:

    A  B           C

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

    X Y 1 - since c > 0 A and B values in table 2 are replaced

    Z BB 2 - since c > 0 A and B values in table 2 are replaced

    DF G 0 - since c = 0, there is even value in table 1

    Post edited by: Parth272025

  • How to insert point decimal all by selecting data from a table

    Hi all

    My select requirement says, if the value received with no decimal place then insert decimals before last 2 bytes. I need to recover the data with this condition.

    May help people how I can achieve this?

    Thanks in advance,
    Yvan

    997936 wrote:
    This will not work if the values are of 5 bytes.

    It should work for any number of digits...

    select 1234567/100 from dual;
    
    SELECT DECODE (INSTR (1234567, '.'), 0, 1234567 / 100, 1234567) FROM DUAL;
    

    Output:

    12345,67

    See you soon,.
    Manik.

    Published by: Marty on April 4, 2013 08:53

  • Create the form for selecting data in multiple tables

    Hello

    I'm getting APEX for the first time and I just read 2 days dev Application Express guide

    I tried to play and I can't create a report with the form that select data from several tables

    What I want to achieve is a report we'll say 'USERS' makes MANAGER_ID ID, NAME, with a form that allows me to create, delete, change users

    The problem is that, once the report with the form created, if I click on create (to create a user) it will ask me for id, name, and manager_id

    I need a water drop down which allows me to select managers in the table manager instead of manually insert Director id

    How do I do that?

    Thank you!

    HI Chris,

    LOV will use this magic.

    Search:

    Kind regards

    BEnjamin

  • B2B is collecting data from the IP_IN_QUEUE

    Hello
    We have 810 process dating to the doc revision number 5010. Although we pass all required header required by B2B settings, then too is not the collection of data from the IP_IN_QUEUE.
    The data is generated from Oracle Apps and passed to SOA that sends data in this B2B Queue.FRom this queue server B2B should choose the data automatically and treat, but this isn't the case.
    We are too ignorant as any error in the logs of B2B.
    Please share your ideas.

    Concerning
    AYUSH

    Hi Mary,

    then too is not the collection of data from the IP_IN_QUEUE

    B2B selects data from IP_OUT_QUEUE. Please configure consequence. IP_IN_QUEUE is for incoming messages.

    Kind regards
    Anuj

  • DB connectivity Kit: syntax error in a SELECTION of data from joined tables

    Hello everyone

    I'm putting in labview a SQL query on joined tables.

    As an example I take a database to store the data of basketball 2on2 matches, which tables are

    corresponds to (matchId, Thomas, teamB)

    teams (teamId,PlayerAname, PlayerBname, nationality)

    nationalities (NatId, natName)

    To get an array of result with the game as well as the names of player as well as their nationality, I use this query on MySQL (which works on command line interface)

    SELECT MatchID,
    T1. PlayerAName, t1. PlayerBName, n1.natName,
    T2. PlayerAName, t2. PlayerBName, n2.natName
    MATCHES m
    INNER JOIN teams t1 ON t1.teamID = m.teamA
    INNER JOIN teams t2 ON t2.teamID = m.teamB
    INNER JOIN nationalities L1 ON n1.natID = t1.nationality
    INNER JOIN nationalities n2 ON n2.natID = t2.nationality

    When I put it in labview, using the block 'select data', I get a syntax error as shown in the attached screenshot.

    Am I something mistanking using the JOIN examples statements or aliases?

    Thanks in advance!

    The select VI is designed to be a simple way to select from a table. I doubt that he can do joins (and would not certainly need the 'FROM', even if it can). What you can do instead calls the query execute VI and give him the complete SQL query. I don't remember if it returns the data in the recordset object, so you must do so separately.

  • Select the list box file and read the data from file

    I can list the files in the folder in the listbox

    1. I want to just list file .txt files

    2. How can I read data from the selected file (.txt)?

    I think that's what you want, enter a model in your list of files vi (for example, *.txt) and then just use File.vi text of reading by using the selected item in the list box (double click on event or value change) and use the starting for the vi records list path.  I have included a crude extract for your pleasure.

  • Pulling data from a selection of the option button to use in the field

    I have a radio with 9 options button (1 000, 2 000, 3 000... 9 000). It's a form of insurance, and I can't change to a drop down or fill-in, etc..  I need a later field in the form to the number they chose in the option box.  For example, if some select 3rd in the series of radio (3,000) button I want Field2 fill-in auto number 3 000.

    Is it possible to do an if / then statement to extract data from the radio button option?  I could do this in Excel but don't have a clue how to do here.  And I don't know about Java.  :-(

    Any help would be appreciated!

    Carol

    You can try this custom script that another user here suggested to me

    You click on properties > Calculate > custom calculation Script > change

    Then paste this in...

    var v = this.getField("Name_of_Radio_button_grouping").value;

    If (v == "1000") event.value = "1000";

    else if (v == "2000") event.value = "2000";

    else if (v == "3000") event.value = "3000";

    else if (v == "4000") event.value = "4000";

    else if (v == "5000") event.value = "5000";

    else if (v == "6000") event.value = "6000";

    else if (v == "7000") event.value = "7000".

    else if (v == "8000") event.value = "8000".

    else if (v == "9000") event.value = "9000".

    etc.

    else event.value = "";

  • Select the data from collections plsql

    Hi all

    I'm not a developer but working as a DBA, so not very familiar with pl/sql, always crossed with documentation and could lead to a solution of my problem. I need advice from expert here.

    Problem: I am writing in a kind of special program plsql for surveillance of certain lots, I know that we have much option to do the same db/grid control including... etc but for some
    the reason I have to do this, use only plsql.

    Requirement: my requirement is to select data in the plsql table and then have the opportunity to ask questions again and again. I prefer not to go to table, rather than directly from plsql...

    I wrote below the code for the sample, bulk data in collection type collection and can print using the loop.

    Declare
    TS type is table v$ session % rowtype index by pls_integer;
    tsess ts.
    Start
    Select * bulk collect into tsess from v$ session;
    I'm looping 1.tsess.count
    dbms_output.put_line (tsess (i) .terminal);
    end loop;
    end;
    /

    But is it possible same collection (tsess in the example above) can be queried using a select as ' select * from table (Tsess) "I searched the net and found this can be done using create type at the database level.» But my problem is that I can't create any object in the database as being it's a production one.

    I was looking as if is it possible even can be accomplished... as cast / multiset... However, I could not get it through.

    your help would be appreciated!

    Kind regards

    I don't think you should use the tables here, only SQL, take a look at the factors of subquery and will indicate if it is not enough...

    Published by: BrendanP on February 12, 2012 03:07 for an example:

    I understand you want to "Refresh" of data that you already have the database purely to be able to use the SQL such as ORDER BY in multiple ways. Here's how you can do it in the original SQL for a particular example, where you query v$ sql time control processor and disk reads separately (I tested it but the result won't be good look here, so omitting it):

    WITH v AS (
    SELECT
        Substr (sql_text,1,500)             sql_text,
        cpu_time/1000000                    cpu_seconds,
        disk_reads,
        buffer_gets,
        executions,
        CASE WHEN rows_processed != 0 THEN Round( buffer_gets / Nvl (Replace (rows_processed, 0, 1) ,1)) END Buffer_gets_rows_proc,
        Round (buffer_gets / Nvl (Replace (executions, 0, 1), 1)) Buffer_gets_executions,
        elapsed_time / 1000000              elapsed_second,
        module
    FROM v$sql s)
    SELECT
        'CPU'                order_by,
        cpu_seconds          order_val,
        sql_text,
        cpu_seconds,
        disk_reads,
        buffer_gets,
        executions,
        buffer_gets_rows_proc,
        buffer_gets_executions,
        elapsed_second,
        module
    FROM v
     UNION
    SELECT
        'Disk reads',
        disk_reads,
        sql_text,
        cpu_seconds,
        disk_reads,
        buffer_gets,
        executions,
        buffer_gets_rows_proc,
        buffer_gets_executions,
        elapsed_second,
        module
    FROM v
    ORDER BY order_by, order_val DESC
    
  • Week of the year (from Monday to Sunday)

    Hi guys,.

    I searched 'Week of the year' and that you have not found a solution to my problem.

    I think that the standard Oracle 'IW' function returns the week of the year beginning January 1.  This year, for example, Monday, January 6 is back as week 1 because on 1 January was Wednesday, therefore, it is in the 1st 7 days of the year.

    Select to_char (to_date(:p_date,'DD/MM/YYYY'), 'IW') wrong_week_no

    , to_char (to_date (: p_date + 2, ' DD/MM/YYYY'), 'IW') correct_week_no

    of the double

    I would like the query to return the week number from Monday to Sunday, so in this case, the 6th should return as number 2 of the week.

    In the query above, by adding 2 to the date gives me the correct week number but won't work for 2015 and 2016.

    Any help would be appreciated.

    I use the Oracle 10 g platform.

    Thank you

    Chris

    Do you mean like this?

    SQL > break the month jump 1
    SQL > set linesize 200
    SQL > set pagesize 2000
    SQL > column month format a20
    SQL > column week format a4
    SQL > with req as (select '& Required_Year_YYYY' year of double)
    2, offset as (select case when to_char (trunc (to_date (yr, 'YYYY'), 'YYYY'), 'IW') in ('52 ', ' 53') then 1 else 0 end as the offset of req)
    3 select lpad (Month, - 20 (20-length (month)) / 2) months.
    4 '('|| semaine ||') ' as the week, "Mo", "You", "We", "Th", "Fr", "Sa", "knew".
    5 of)
    6. Select to_char (dt, 'fmMonth YYYY') month,
    7 case when to_char (dt, 'mm') = '12 ' and to_char (dt, 'iw') = ' 01' and offset = 0 then ' 53 "
    8 when to_char (dt, 'mm') = '12 ' and to_char (dt, 'iw') = '01' and offset = 1 then ' 54'
    9 when to_char (dt, 'mm') = '01' and to_char (dt, 'iw') and ('52', ' 53 ") then"1"
    10 to_char (to_number (to_char (dt, 'iw')) + offset) other end than the week,.
    11 max (decode (to_char(dt,'d'), '1', lpad (to_char (dt, 'GFMD') 2)),) "Mo."
    12 max (decode (to_char(dt,'d'),'2 ', lpad (to_char (dt, 'GFMD'), 2))) "you."
    Max (decode (to_char(dt,'d'),'3 ', lpad (to_char (dt, 'GFMD'), 2))) 13 '' We. ''
    14 max (decode (to_char(dt,'d'),'4 ', lpad (to_char (dt, 'GFMD'), 2))) "Th."
    15 max (decode (to_char(dt,'d'),'5 ', lpad (to_char (dt, 'GFMD'), 2))) "Fr."
    16 max (decode (to_char(dt,'d'),'6 ', lpad (to_char (dt, 'GFMD'), 2))) "his."
    17 max (decode (to_char(dt,'d'),'7 ', lpad (to_char (dt, 'GFMD'), 2))) "Su".
    18 in (select trunc (to_date (req.yr, 'YYYY'), 'y')-1 + rownum dt)
    19 object, req
    20 where rownum<= add_months(trunc(to_date(req.yr,'yyyy'),'y'),12)="" -="" trunc(to_date(req.yr,'yyyy'),'y')="">
    21, offset
    22 group by to_char (dt, 'fmMonth AAAA'), case when to_char (dt, 'mm') = '12 ' and to_char (dt, 'iw') = ' 01' and offset = 0 then ' 53 "
    23 when to_char (dt, 'mm') = '12 ' and to_char (dt, 'iw') = '01' and offset = 1 then ' 54'
    24 when to_char (dt, 'mm') = '01' and to_char (dt, 'iw') and ('52', ' 53 ") then"1"
    25 to_char (to_number (to_char (dt, 'iw')) + offset) to another end
    (26) x
    27 order by to_date (month, "Month YYYY"), to_number (x.week)
    28.
    Enter the value for required_year_yyyy: 2012
    old 1: with req as (select '& Required_Year_YYYY' year of double)
    new 1: with req (select '2012' year of double)

    MONTH WEEK Mo Tu we Th his di ve
    -------------------- ---- -- -- -- -- -- -- --
    January 2012 (1) 1
    (2) 2 3 4 5 6 7 8.
    (3) 9 10 11 12 13 14 15.


    (4) 16 17 18 19 20 21 22.
    (5) 23 24 25 26 27 28 29.
    (6) 30 31.

    February 2012 (6) 1 2 3 4 5
    (7) 6 7 8 9 10 11 12.
    (8) 13 14 15 16 17 18 19.
    (9) 20 21 22 23 24 25 26.
    (10) 27 28 29.

    March 2012 (10) 1 2 3 4
    (11) 5 6 7 8 9 10 11.
    (12) 12 13 14 15 16 17 18.
    (13) 19 20 21 22 23 24 25.
    (14) 26 27 28 29 30 31.

    April 2012 (14) 1
    (15) 2 3 4 5 6 7 8.
    (16) 9 10 11 12 13 14 15.
    (17) 16 17 18 19 20 21 22.
    (18) 23 24 25 26 27 28 29.
    (19) 30

    May 2012 (19) 1 2 3 4 5 6
    (20) 7 8 9 10 11 12 13.
    (21) 14 15 16 17 18 19 20.
    (22) 21 22 23 24 25 26 27.
    (23) 28 29 30 31.

    June 2012 (23) 1 2 3
    (24) 4 5 6 7 8 9 10.
    (25) 11 12 13 14 15 16 17.
    (26) 18 19 20 21 22 23 24.
    (27) 25 26 27 28 29 30.

    July 2012 (27) 1
    (28) 2 3 4 5 6 7 8.
    (29) 9 10 11 12 13 14 15.
    (30) 16 17 18 19 20 21 22.
    (31) 23 24 25 26 27 28 29.
    (32) 30 31.

    August 2012 (32) 1 2 3 4 5
    (33) 6 7 8 9 10 11 12.
    (34) 13 14 15 16 17 18 19.
    (35) 20 21 22 23 24 25 26.
    (36) 27 28 29 30 31.

    September 2012 (36) 1 2
    (37) 3 4 5 6 7 8 9.
    (38) 10 11 12 13 14 15 16.
    (39) 17 18 19 20 21 22 23.
    (40) 24 25 26 27 28 29 30.

    October 2012 (41) 1 2 3 4 5 6 7
    (42) 8 9 10 11 12 13 14.
    (43) 15 16 17 18 19 20 21.
    (44) 22 23 24 25 26 27 28.
    (45) 29 30 31.

    November 2012 (45) 1 2 3 4
    (46) 5 6 7 8 9 10 11.
    (47) 12 13 14 15 16 17 18.
    (48) 19 20 21 22 23 24 25.
    (49) 26 27 28 29 30.

    December 2012 (49) 1 2
    (50) 3 4 5 6 7 8 9.
    (51) 10 11 12 13 14 15 16.
    (52) 17 18 19 20 21 22 23.
    (53) 24 25 26 27 28 29 30.
    (54) 31

    64 selected lines

    I used 2012 for example, because in this case, it has 54 weeks.

    So, here we have 1 January during the week 1, but 2 January's second week, as is Monday, etc.

  • ORA-00942 on sys when SELECT table_name FROM all_tables;  11rg2 (answered)

    I run SQLPLUS on windows and use sqlplus.
    Conn sys as sysdba. Fine
    Then, I want to see the tables under sysdba
    I create the table and I can do SELECT * from table. SQL watch me release.
    But I can't see tables
    SELECT table_name FROM user_tables;
    SELECT table_name FROM all_tables;
    SELECT table_name FROM dba_tables;
    SELECT * from user_objects where type_objet = "TABLE";

    SQLPLUS:ORA - 00942: table or view does not exist.

    How to fix it?
    I created earlier DB and could do that, but I want to repair this database.

    And he had problems with db mynewdb1, may be corrupt

    recover database until cancel using backup controlfile;
    ORA - 279 marked during: ALTER DATABASE RECOVER database until cancel using backup controlfile...
    ALTER DATABASE RECOVER CONTINUE DEFAULT
    C:\APP\STR\FLASH_RECOVERY_AREA\MYNEWDB1\ARCHIVELOG\2013_05_10\O1_MF_1_1_%U_ media recovery log. ARC
    Friday 10 May 21:06:30 2013
    Errors with log C:\APP\STR\FLASH_RECOVERY_AREA\MYNEWDB1\ARCHIVELOG\2013_05_10\O1_MF_1_1_%U_. ARC
    Errors in the C:\APP\STR\diag\rdbms\mynewdb1\mynewdb1\trace\mynewdb1_pr00_9920.trc file:
    ORA-00308: cannot open archived log ' C:\APP\STR\FLASH_RECOVERY_AREA\MYNEWDB1\ARCHIVELOG\2013_05_10\O1_MF_1_1_%U_. ARC'
    ORA-27041: could not open the file
    04002 - OSD: could not open the file
    S/O-error: (OS 2) the system cannot find the file specified.
    ORA - 308 marked during: ALTER DATABASE RECOVER CONTINUE DEFAULT...





    CREATE CONTROLFILE REUSE DATABASE RESETLOGS MYNEWDB1
    WARNING: Temporary Tablespace default not specified in the CREATE DATABASE command
    Default temporary tablespace will be necessary for a locally managed database in future release
    Errors in the C:\APP\STR\diag\rdbms\mynewdb1\mynewdb1\trace\mynewdb1_ora_8588.trc file:
    ORA-01565: error to identify the file ' % ORACLE_HOME%\DATABASE\DBS1%ORACLE_SID%. ORA'
    ORA-27041: could not open the file
    04002 - OSD: could not open the file
    S/O-error: (OS 2) the system cannot find the file specified.
    ORA-1503 scored at the course: CREATE CONTROLFILE REUSE DATABASE RESETLOGS MYNEWDB1...

    Published by: 1005307 on 10.05.2013 18:08

    Hello

    Welcome to the forums!

    What you showed us, I guess that you have created the database manually using the CREATE DATABASE command?

    If so, did you run CATPROC.sql and CATALOG.sql correctly? It seems that your problem is related to these scripts, because they are responsible for creating the tables and the data dictionary views.

    Have you run them with SYS schema?

  • How to exclude a date from a query

    Hi all

    I have a request to the user that are not sice connection 2 days of audit, but to exclude these days that are holidays in the calculations.

    SELECT active_directory_user FROM SYSTEM_USERS WHERE active_directory_user IN
    (SELECT DISTINCT active_directory_user from admin. SESSION_AUDIT WHERE LOGON_TIME < SYSDATE-1);
    How to exclude Sundays for example?
    My paintings is less than
    SQL> DESC SYSTEM_USERS
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     ACTIVE_DIRECTORY_USER                     NOT NULL VARCHAR2(30)
     PASSWORD                                           VARCHAR2(50)
     DEPT                                               VARCHAR2(20)
     ROOM                                               VARCHAR2(10)
     ROOM_PHONE                                         VARCHAR2(30)
     MOBILE#                                            VARCHAR2(20)
     TOTAL_LOGINS                                       NUMBER
     USER_STATUS                                        VARCHAR2(20)
    
    SQL> DESC SESSION_AUDIT
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     ACTIVE_DIRECTORY_USER                              VARCHAR2(30)
     LOGON_TIME                                NOT NULL DATE
     APPLICATION_USER                          NOT NULL VARCHAR2(30)
    Published by: Maahjoor on February 5, 2013 22:50

    Maahjoor wrote:
    Hi all

    I have a request to the user that are not sice connection 2 days of audit, but to exclude these days that are holidays in the calculations.

    SELECT active_directory_user FROM SYSTEM_USERS WHERE active_directory_user IN
    (SELECT DISTINCT active_directory_user from admin. SESSION_AUDIT WHERE LOGON_TIME<>
    How to exclude Sundays for example?

    select active_directory_user
    from system_users
    where active_directory_user in
      (
        select distinct active_directory_user
        from admin.session_audit
        where logon_time
                     
    

Maybe you are looking for