CHECK that column Date constraint check is Monday or not

Hello

I have a table with the unique constraint with column start_date, end_date etc. Now, I need to add the CHECK constraint to column start_date and end_date. CHECK if contains value insertion should be only Monday to Sunday only for end_date and start_date arguments.

Please give me ALTER statement or any function to handle this scenario.

Thank you...

ALTER TABLE Table1 ADD
(
CONSTRAINT chk_cons1
CHECK
(
Trim (to_char (start_date, 'day')) = "Monday".
and trim (to_char (end_DATE, 'day')) = "Sunday".
)
)

Edition - last bracket missing :)

Tags: Database

Similar Questions

  • Need to request so that the data dictionary

    Hi all

    I need an application that can show all the details of the tables in my database

    request to see the... : table name, type of name of column data, constraints, default value, etc...

    I found two tables in the database that showa all this information... Here are the 2 quiries:

    Select table_name, column_name | » ('|| DATA_TYPE | (' ('| data_length |')) "column_name from all_tab_columns

    where OWNER = "UBSPROD."

    Select constraint_name, constraint_type, table_name, search_condition_vc, index_name

    From user_constraints where owner = "UBSPROD";

    but when I join them I get a lot of records... I mean I think he's going to cartiantion products

    I used query below:

    Select at.table_name, at.column_name |' ('| at.data_type |') ('|| at.data_length||')) "column_name,
    UC.constraint_name, uc.constraint_type, uc.table_name, uc.search_condition_vc, uc.index_name from all_tab_columns to, uc user_constraints
    where at.owner = 'UBSPROD. '
    and at.table_name = uc.table_name

    Please, help me to display information with all tables of database related...

    Thank you

    The reason you see too many lines is because one table lists columns and a list of constraints and want to join the table name. So if you have a table with 3 constraints and 5 columns, you get 15 lines, which probably makes no sense.

    Have a reflection on what data you actually want to display for each table. There is a many-to-many relationship between columns and constraints (each column can contain zero or more constraints, each constraint can use more than one column), is without doubt better to keep the two separate, for example

    COL1

    COL2

    COL3

    COL4

    COL5

    CONSTRAINT1

    CONSTRAINT2

    CONSTRAINT3

    This would be achieved either with two separate queries, or you can use a UNION ALL operation, as appropriate. If you want to display the columns used in a constraint, you must query the synonym ALL_CONS_COLUMNS.

    Also, make sure you are compatible by using the ALL_ or synonyms USER_ - do not mix the two.

  • Video metadata date is incorrect: the value and not of creation date sharing

    10 iOS, iPhone 6 +, Windows 10. Photos and videos are shared through iCloud, but NOT stored in iCloud.

    Once synced on my PC, the photos and videos have a truncated name (for example, "016a1f2e11dfcc680e1009cb96346b67678fb2c6bc.jpg"). Of course, this is not acceptable at all to me when I organize them on my NAS: I prefer a significant, sortable name, as "2016-09-16 18-15-20259 (Apple iPhone 6 more) .jpg.

    To do this, I simply read the EXIF information directly from the image, and I rename the image accordingly. No problem for the photos.

    But for videos... I do the same, in the world, but with less information. I can extract only creation date/time from metadata of the videos, not the unit that captured video. Sad, but I have not found anything else, and at least it's automatic.

    Recently, I found that the date in the video file is NOT correct: this is the timecode of SHARING via iCloud, not the timecode CAPTURE. I have therefore some videos with a delta of two weeks between the true creation as well as the "official" date

    I checked this on my phone: date is correct (once the video is no longer in full screen, the date is displayed at the top of the screen, and it is 'the' date I'm looking).

    So, question: How can I get the date of the 'real' creation of all these videos on my PC? It exists: it appears on the iPhone that took the video (a woman) AND mine. Information is 'lost' only on the PC, but I think it's a problem of reading of 'bad' metadata (I use FFMPEG to get currently), or the wrong file for reading (perhaps within an iTunes/database file, but didn't find, not found in the registry or the other).

    Best solution is to find something operate locally, through the command line, to do it in batch mode. A solution of GUI PEUT agree if I can automate with AutoIt (i.e. should not be a native Win32 application, not Java, .NET, GTK, QT and so on, OR must have an export feature). A solution based on the web is not suitable, but can be less boring to review each video one after another to manually check the date.

    Thanks in advance.

    In my opinion, the only way to fix this is with third-party software like this one.

  • Date constraint CHECK

    Hi all

    I am a MCs of the database systems and I'm working on a project. I'm having trouble creating my table that must have a date constraint.

    The constraint is the following: all dates (except the proj_date) that is stored cannot be after the current system.

    -Creating purchase order Table
    CREATE TABLE purchase_order)
    po_no NUMBER (5)
    Purchase_order_po_no_pk the CONSTRAINT PRIMARY KEY NOT NULL,
    proj_no NUMBER (5)
    CONSTRAINT purchase_order_proj_no_fk
    REFERENCES project (proj_no) ON DELETE CASCADE,
    po_date date CONSTRAINT purchase_order_po_date CHECK (po_date < sysdate));


    I'm getting ORA - 02436 Date or system variable specified wrongly with the check constraint.


    Please I need help.

    I thank very you much in advance!

    Kind regards

    Did you see the description of the error?
    http://docs.Oracle.com/CD/E11882_01/server.112/e17766/E2100.htm#sthref1524

    If I remember correctly, the use of features like USER, SYSDATE is not allowed for the check constraint.

    Aman...

  • How can we check that the data already exist in the database

    Hi friends

    I'm trying to create a procedure for adding clients in the database with the customer id as input parameter... but if the customer details database already exists that I would update this detail and is not in the database I want to add this detail in the database... How could I do that...

    any help would be appreciated

    Thank you
    Rommy

    Hello

    If your condition is to add to a table, and if the record exists in the other table, the merge statement does not work

    Example (Please check the column name and the parameter names). I do not commit or rollback because I do not know if you control the transaction within this procedure or outside it.

    CREATE OR REPLACE PROCEDURE add_cust(I_CUST_ID        IN VARCHAR2,
                                         I_CUST_F_NAME    IN VARCHAR2,
                                         I_CUST_L_NAME    IN VARCHAR2,
                                         I_CUST_ADD       IN VARCHAR2,
                                         I_CUST_CITY      IN VARCHAR2,
                                         I_CUST_STATE     IN VARCHAR2,
                                         I_CUST_ZIP       IN VARCHAR2,
                                         I_CUST_DOB       IN DATE,
                                         I_CUST_          IN VARCHAR2,
                                         I_CUST_ACCT_TYPE IN VARCHAR2,
                                         I_START_BAL      IN NUMBER) IS
    BEGIN
       INSERT INTO CUSTOMERS C
          (CUST_ID,
           CUST_F_NAME,
           CUST_L_NAME,
           CUST_ADD,
           CUST_CITY,
           CUST_STATE,
           CUST_ZIP,
           CUST_DOB,
           CUST_)
       VALUES
          (I_CUST_ID,
           I_CUST_F_NAME,
           I_CUST_L_NAME,
           I_CUST_ADD,
           I_CUST_CITY,
           I_CUST_STATE,
           I_CUST_ZIP,
           I_CUST_DOB,
           I_CUST_);
    
    EXCEPTION
       WHEN DUP_VAL_ON_INDEX THEN
          INSERT INTO CUSTOMER_ACCT
             (CUST_ID,
              CUST_ACCT_NO,
              cust_acct_type)
          VALUES
             (I_CUST_ID,
              CUST_ACCT_SEQ.NEXTVAL, -- CUST_ACCT_SEQ is a sequence, isn't?
              I_CUST_ACCT_TYPE);
    
    END add_cust;
    

    Kind regards

  • Firefox does not start because he says that it's another instance that runs in the background, but I checked and it is not a!

    Firefox does not start because he says that it's another instance that runs in the background, but I checked and it is not a! I have Linux Fedora 15 and I'm not the root. I spoke to the Manager and he said I should delete a file in the folder where firefox is installed and which can solve the problem. Can you help me?

    Thanks, Marius
    

    Upgrade your browser Firefox 8 and check

  • Can you display text after that you checked a box or not?

    Can you display text after that you checked a box or not?

    Ex:

    • Yes (please contact Bob x 3-1234) only want it to appear when you check the box)
    • NO.

    Sure. If you use a field (text field, button) to display the text, the script of the mouse to the top of the Yes box could be:

    getField("button1").display = event.target.value = "Yes"? Display.visible: display.hidden;

    Change "button1" to the actual name of the field and 'Yes' is the value of exports of the Yes box. You can use what you want, and you'll probably want to make the button read only as well.

  • ITunes has stopped working, it says that executing data closed itunes for protect my computer after installing IE9

    Original title: Itunes does not work with Internet Explorer 9

    I recently installed Internet Explorer 9 and since then, I had problems with my itunes. My itunes will not load. I uninstalled itunes and installed again, but it won't work. When I open itunes, I get an error saying that itunes has stopped working. He told that executing data closed itunes to protect my computer. Why - what is closed it? Help, please. Thank you!

    Hi AndreaB1983,

    Data Execution Prevention (DEP) is a security feature that protects against viruses and other security threats by analyzing your programs to make sure that they use the system safely memory.

    Method 1:  Follow the steps mentioned in the link below to turn off DEP for ITunes and then check

    Change Data Execution Prevention settings
    http://Windows.Microsoft.com/en-us/Windows-Vista/change-data-execution-prevention-settings


    Note:
    turn off DEP for a program that you trust. See the link below
    How can I prevent DEP from closing a program that I hope?

    Method 2:  Put the computer to boot and then check if the problem persists

    Follow step 1 in the link below,
    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7

    Important: n ' forget not to put the computer to a normal startup follow step 7 in the link.

    You can check with Apple to known problems:
    http://www.Apple.com/support/contact/

  • How to ensure that no data is ever stored on the servers of the low COST airlines?

    In particular, I would like to use the SimpleChat and SharedWhiteboard in a secure application and will not have any data stored on the servers of LCCs (only used to manage the flow of data). At least, I don't want to have data stored between sessions, but the 'sessionDependent' of these two pods property doesn't seem to work (ie. when the value 'true' history of cats and forms of Whiteboard are preserved between sessions).

    I put in a few hooks to clear both at the end of the session and the start of a session, but what I really want, is to ensure that the data never be stored in the first place.

    Is this possible with these pods, or do I need Custom develop something on my own to support this behavior?

    Thank you

    The data are stored only in memory. When "persistent" we check the configuration node and transitional so we don't save this node on the disk.

    If you're really worried about a security breach, you should probably encrypt your messages before you send them through companies low-cost (it should be easy to subclass the current models and encrypt/decrypt points on the fly).

  • Edition of text column data Format database columns of answers

    Hello

    We use Oracle Business Intelligence Enterprise Edition v10.1.3.4 on the cube for OLAP Oracle 11 g. Reports we create have (among other things) columns with an underlying type of VARCHAR data in oracle tables.

    When we try to change the properties of such a VARCHAR column column, "Data Format" tab shows only 'Plain Text' as an option under the menu drop-down "Override default data Format". Options to display the text 'HTML' or 'LINKS', etc. are not available.

    All entries on what can be done in the answers or the repository to get these options for formatting of column data are highly appreciated.

    Thank you
    Piyush

    You set your HardenXSS to false in the instanceconfig.xml file? By default, OBIEE is set to true. Setting to false allows the HTML tags to appear as options for fields VAR. check it out here... Chapter 2, page 37.

    http://download.Oracle.com/docs/CD/B40078_02/doc/bi.1013/b31766.PDF

  • I used to have the date on my email accounts, but not now. How can I get that back?

    no date on the enamel of windows.

    If you double-click the message to open it in a separate window, you can see the date?  If so, then try to view | Columns and make sure that the date field is included.

    Otherwise, try compacting and repairing the database (see www.oehelp.com/WMUtil/).

    Steve

  • "kernel_security-check-failure" and "lrql not less or equal.

    May I ask if there is a software that can fix "kernel_security check failed" and "lrql not less than or equal '? Most of the software only can diagnose the problem, I am looking for a software that can solve the problem. Thank you

    Rachael

    To get out of the win safe mode key + 'X' > (Admin) command prompt > type msconfig.  On the first page check start normally.  If you have not set your crash recovery will likely lead to the problem of the origin of the problem back to normal boot

    What mail?  This is a public forum and there is no mail involved.

  • Checking the status did not return ACS version after update 4.0 to 6.0

    We are in the (stable) the ACS of 4.0 to 6.0 upgrade process.  The only problem that we see, is that after the upgrade, check the State does not return a version.

    We use the check.js provided by Adobe, but get to the result of the call.

    .. / Status? check = version

    The appeal has changed, or are we missing a configuration somewhere property?

    I guess nobody don't Adobe never look at this forum...

  • Unable to store the component "time" in the column date Oracle's ADF

    Hi friends,

    I have a table with the date column. I'm trying to set the current date with the time in the column of the table. Java.sql.Date refers to the field of the VO. When I try to turn it using the setLastUpdatedDate() it not be saved. The time is get truncated and the time is saved is 16-mar-2015 00:00:00.  How can I keep the component "hour" as well in the column with the date data type. FYI the component "hour" is saved when I do the sql uisng the insert.

    JDev version is 11.1.1.7.0

    Thank you

    Hello

    java.sql.Dateis the DATE of SQL which means it stores years, months and days whilehour, minute, second and millisecond are ignored. Also sql.Date is not related to time zones.

    java.sql.Timestampcorresponds to the SQL TIMESTAMP, which is the exact nanosecond (Note that util.Date only supported milliseconds!) with customizable precision.

    try to use the timestamp if you want exact

  • Confusion of length of column data type

    Hi all

    To learn about my column data type and length, I have run the following query. However, when I confirm it with the table_name desc command, I see that the lengths of data do not correspond. You have an idea?

    > > select column_name | » '|| DATA_TYPE | » ('|| ( data_length|') ' col_info all_tab_columns where table_name = 'CUSTTABLE' and column_name = 'ACCOUNTNUM;

    > > ACCOUNTNUM NVARCHAR2 (24)

    > > desc CUSTTABLE.

    > > ACCOUNTNUM 1 N NVARCHAR2 (12)

    Concerning

    Charlie

    NightWing wrote:

    By the way I couln t understand what were you thinking when you explain to no.

    I missed you NVARCHAR2 column and thought it was VARCHAR2. When you declare the semantics of VARCHAR2 column length is specified explicitly or implicitly. Explicitly suffixing length with BYTE or CHAR and implicitly when you specify the length of the right itself. Then length is based on the value NLS_LENGTH_SEMANTICS session. So let's assume you generate table create statement (and it seems that you is, based on column_name |) » '|| DATA_TYPE | » ('|| ( data_length|') ' ). Then it does not matter if use use data_length or char_col_decl_length. It will be regadless semantics implied length of what you use. Therefore, when you run create table instructions column length will be interpreted as bytes if current NLS_LENGTH_SEMANTICS byte value. But same length is interpreted as the characters if current NLS_LENGTH_SEMANTICS a char value. As you can see, in order to generate create table statement we use explicit semantic length column, otherwise create table statement can produce lengths of different column in the source table.

    SY.

Maybe you are looking for

  • Since the update cannot return to my home page

    Since Firefox updated I can't open it with my original homepage. Tried to change through the tools and it shows my home page, but it always opens to the mozilla page.

  • Motherboard replacement for a Presario all-in - One SG2 - 210UK

    Wonder if anyone can help solve the apparently impossible task of stock up to a card mother SP #619968-001 Privas MC11 for my SG2-210uk Presario A-I-O... HP UK have quoted more than £400 for the repair of a machine of at least 2 years (dead graph). I

  • How to get the windows on lenovo thinkpad x 201 product key

    Hi allNeed help please, I used to computer laptop lenovo x 201, but the windows product key been removed sad Smiley. also the warranty has ended, so how can I get the product key? Help, please [Title edited for clarification]

  • 3D - multiple lights picture

    Is there a way to apply different lights (combine colors) on the same texture object? I had tried several things, but none of them give me the expected result. Look at the attachment. PS: Using LabVIEW 2015.

  • How to change a file format of the psd to jpg?

    I'm an avid user of Photoshop. But I got this new computer and now every time I save a file from Photoshop (psd file) it won't let me open it with any other program. Ideally, I would like to be in a jpg format so I can open it with any program. Help,