Restrict records

Hi I have the following table for a school management system
CREATE TABLE INCENTIVE
(INCENTIVE_ID NUMBER NOT NULL
,IC_STU_ID NUMBER(10,0)
,IC_CLASS_ID NUMBER(10,0)
I need to restrict the ammount of records created to 5 per class, i have no idea how to do this, i suspect i may need another attribute like something to measure against maybe a date but each class has up to 5 incentives awarded each lesson - no more than 5 allowed, how do i restrict the teachers from adding more than 5??
thanks

  Alter Table incentive
    Add Constraint incentive_c01 Check (incentive_id in (1,2,3,4,5));
is this checking weather an incentive id exists?
it is checking by way if the incentive id is inserted in the range of 1 to 5. if attempted to insert another values other than what was specified in the check constraint it will error out.
the constraints above does not enforce the actual logic of your requirement. it is only good for preventing other values for the specific columns to be inserted into the table. supposed there are two class 1 and 2 and each class has the allowable 5 incentive. now there's an attempt to insert another row which basically has 5 incentive for class 1. the constraint looks only for the incentive and will not prevent a duplicate record which has class 1 and incentive 5 which i think is also what you want to prevent. to prevent it you will need another constraints that are unique rows by way of combination of a columns.
  Alter Table incentive
    Add Constraint incentive_u01 Unique (class_id, incentive_id);
or probably you will also need a trigger to restrict insertion of rows or a logic in your pl/sql code. a constraints has limitation and is specific and you cannot have a logical codes on it. what you will need is a code that checks for some conditions for the transaction or process that will meet your requirements.

Similar Messages

  • How we can restrict record in CTL file on the basis of other table ?

    Hello all,
    How we can restrict record in CTL file on the basis of other table ?
    Eg.
    I have following control file to load the records in the table through the sql loader.
    LOAD DATA
    INTO TABLE THIST APPEND
    FIELDS TERMINATED BY "|" TRAILING NULLCOLS
    LNUM POSITION(1) Char "substr(:LOAN_NUM, 4, 13)",
    TSRNUM Char "rtrim:TRAN_SR_NUM)" ,
    TPROCDT Char "to_char(to_date rtrim:TRAN_PROC_DT), 'MMDDYYYY'), 'YYYYMMDD')"      
    I have another table c all TFILE in which I have LNUM. I want to import only those records from input text file using the control file and sql loader in which LNUM is exist in the TFILE.
    So how i can restrict it in the Control File.
    Thanks
    Kamlesh Gujarathi
    [email protected]

    Hello Satyaki De.
    Thank you very much for your suggestion but my Private information is totally apart from this question & I already I have changed each and every information from the question.
    Thanks
    Kamlesh Gujarathi
    [email protected]

  • How to restrict records in Infoset query

    Hi Friends,
      I have created an Infoset & a query based on this infoset. I would like to restrict certain records being displayed, based on field value, say if field A = 'Blank' I do not want to see this record on the Bex report.
    Please let me know if this is possible at all.
    Thanks,
    JB

    Hi,
    if you want to restrict a report based on a characterristic value you have to:
    1)Open the query in design mode
    2)Insert the characteristic in your report (in this example field "A")
    3)Double clikc in the characteristic
    4)You will see 2 tabshett, here you have the option to restrict in a estatic (using a fix value) or dinamic value (usign variable)
    5)For example use static value, select the desire value and then OK
    6)Save
    7)Execute.
    Regards
    Asign points if useful please

  • Restricting records in the select statement

    Hi,
    I have one requirement where in i need to restrict my select statement to get only 250 records in the output table.
    Here are the select statements i am using....
        SELECT a~ebeln
                     a~lifnr
                     a~ekgrp
                     b~werks
                     b~matnr
               FROM ekko AS a INNER JOIN ekpo AS b
               ON aebeln = bebeln
               INTO TABLE i_ekko
               WHERE a~ebeln IN r_ebeln AND
                            a~lifnr IN r_lifnr AND
                            a~ekgrp IN r_ekgrp AND
                            b~werks IN r_ewerk AND
                            b~matnr IN r_matnr AND
                            a~bstyp = 'F'.
                IF NOT i_ekko[] IS INITIAL.
    Select Vendor name
               SELECT lifnr
                            name1
                      FROM lfa1
                      INTO TABLE i_lfa1
                      FOR ALL ENTRIES IN i_ekko
                      WHERE lifnr = i_ekko-lifnr.      
    Here if i restrict the first select statement to get only 250 records then i am not getting the desired record in the second select statement.
    Could anyone let me know how to write the select statement.
    Regards,
    Ramesh

    restric the first select using up to 250.
    sort the i_ekko by vendor name.
    ex: sort i_ekko by lifnr.
    use second select statement here.

  • Restrict records in Pivot View

    Hello
    Is it possible to restrict # of records to be displayed in Pivot view.
    Thanks in Advance

    Hi,
    Not without applying filters directly to the underlying report.
    Alternatively use your pivot to summarise the data at a higher level and create a drill down into a seperate report. If you setup the more detailed report in a table view you can limit the number of rows shown to the user (the setting that defines how many rows are displayed before having to hit the button to show all report rows)
    Thanks
    Oli @ Innoveer

  • Restricting record in the select query

    Is there any way to restrict the number of search (e.g 10) records in the SELECT query ?

    Hi,
    You can use as below:
    select <fieldname> up to 10 rows from <tablename> into itab.
    Thanks,
    Sriram Ponna.

  • Restrict records of table

    Hi experts,
    I have created a Y-table and have created table maintenanace generator for the same.I have a report by means of which i enter data into this table.
    i have given serial no. as a primary key. Now my requirement is that as the records get entered into this table, i want to give a limited access to thistable.
    Like if the table has 10 entries from sr. no 1 to 10, then the user should be able to see only the records with serial nos. 1 to 5. Or the user should be able to see only record no. 3
    and not the remaining. Is it possible to do so. And what is the use of the Authorisation group that we give in table main. gen. Can this requirement be met on the basis of auth. grp.
    Thabks in advance

    Hi Priti,
    It can be done by Basis by giving setting read and write access to particular authorization groups. But this restriction is also up to some level where it can say only upto n records on a total of m records can be viewed can be set, but not like n/2 records of total n records is possible. As this display depends mostly on the selection-screen input.
    Regards,
    Sumalatha.

  • How to restrict records entry in a tabular block.

    Hi Guys,
    I have created a tabular block on my form. Now for a certain condision i want to restrict user, so that s/he cant enter more then 2 records in a tabular block.
    I want to implement this check either at the time of record save OR as soon as user navigate to the third record.
    Pliz help to implement this check on a block.
    Regadrs,
    Imran Baig

    Hello,
    You could implement the test in the WHEN-CREATE-RECORD trigger
    If Get_Block_Property( 'the_block_name', CURRENT_RECORD ) > 2 Then
    End if

  • Restrict records in Query

    Hi All,
    I need to restrict the records in my query based on transactions. 
    Ex: Company Code     Date         Cost Center   Amount
             10000             1/1/2000          100             20000
                                   2/1/2000          200             30000
                                                          100             40000
    if more than one transaction, then only it has to show in the Report. 
    Example: Two transactions done on 2/1/2000(this transaction has to show in the report). on 1/1/2000 only one transaction So, i willn't be display in the report.
    What i need to to. Can i create keyfig count in cube?
    Please help me on this.
    Thanks,
    KN

    Hey you can try this.
    Create a calculated Key figure.Put some key fig into it.
    In the next step click the enhance button ---> there you can define exception aggregation as "Couting all values" and reference characteristic as your key date.And put the conditon count >1 in query.
    or
    Create a key fig COUNT as number and in aggregation choose exception aggregation as counting all values and ref char as tdate.This should do it,use it in the cube,dont map anything to it and use this in query condition as count >1.
    Hope this helps.

  • File sender to read restricted records using FCC

    Hi Experts,
      My requirement is read data from a Flat file of Fixed length the data is as follows
    D000001111B   ADDPT 20070713       
    D000001111B   CTRB  20070713      
    D000001111B   DCRA  20070713       
    D000001111B   DENPT 20070713       
    E000001166B   ADDFD 20070713     
    E000001166B   DENFD 20070713       
    E000001166B   LIFFD 20070713      
    E000001166B   LTDFD 20070713       
    E000001166B   MEDFD 20070713       
    E000001177M   MPPI  20070713       
    E000001122B   ADFD  20070713       
    ie all "D" records come together and all "E" records come together
    The requirement is to read only the first few records of type "D" && few records type "E" but, please note that there is "RECORD SET" in this, i just need to read few of "D" and few of "E" records
    Example: only first 3 "D"s and first 3 "E"s
    suggest me the apt way to do this.
    Pavan

    Pavan,
    Checkout the property "RecordSets per messages"..but you can restrict to top"n" of message only...not to 2 different set of messages as you have mentioned above..
    As satish said it is better if you read all lines into XI and in mapping you can just select top "n" messages of type"D" and "X"..whatever....you will get better control there..
    Nilesh

  • Formula for restricting records

    Hi All,
    I have to restrict the record selection criteria to get the latest modified record for each customer as shown in below example. I cannot use SQL on this datasource so I think I should create a formula and I should use that in record selection criteria but I don't know how to define this formula. Can any one of you please help.
    Ex.
    Customer No             Modification Date       
    10000001                  1-Jan-2009
    10000001                  2-Jan-2009
    10000001                  3-Jan-2009
    10000002                  1-Jan-2009
    10000002                  2-Jan-2009
    Desired result only 2 records
    Customer No             Modification Date       
    10000001                   3-Jan-2009
    10000002                   2-Jan-2009
    Thanks,
    Chetan

    Hi Chethan,
    I think its tough to write formula in select expert for your requirment..
    But here is the another workaround!!!.
    1, Create one new group(If not exists with 'CustomerNo'. Then suppress both Group header and footer.
    2, Then suppress your detail section with this condition.
    if {ModificationDate}=maximum({ModificationDate}, {CustomerNo}) then
    false
    else
    true
    This will work for you,
    Regards,
    Salah

  • Restrict records in CSV file based on condition

    Greetings. I searched the forum for my issue and didn't find an answer or the right search terms. I am running APEX 4.1.1
    I have a report on a page. I am showing all records for a given SQL statement in my table, but in the "Export to CSV" I need to limit the output based on one of the fields. So for example, if I had a report like:
    SELECT x, y, Z
    FROM Table1
    I would like the Export to CSV for that table to limit the output such as:
    SELECT x, y, Z
    FROM Table1
    WHERE Z = 1
    Is that possible?
    Thanks!
    John

    Hi John,
    I have tested the login now and the above works for Interactive report only and for Classic report you need to do something like this because the request is set to different value
    SELECT x, y, Z
    FROM Table1
    WHERE ((Z = 1 and nvl(:REQUEST,'X') like 'FLOW_EXCEL_OUTPUT%') OR nvl(:REQUEST,'X') not like 'FLOW_EXCEL_OUTPUT%')See this working example http://apex.oracle.com/pls/apex/f?p=46417:25
    When you export to csv you will only get dept 10 records

  • Any option to restrict SE16 record level access based on company code?

    Hi All,
    I have a requirement to restrict record level access in SE16 based on company code.
    Our SAP system has two company codes. The requirement is that users of one company code should not be able to see records of other company code in SE16.
    Is it possible through some exits/badis/other methods?
    Thanks in advance.
    Regards,
    Arun Mohan

    You could write a small front end that accepts the company code, applies custom authorization code for each value and retains or removes, then calls the transaction and enters the selections the user requested and that your authorization check resulting in "passing"....  Of course, you'd have to block those users from "pure" SE16...   I once worked in situation similar, users in one country couldn't see USA data, etc. I think someone wrote an entire new program, called by ZSE16, for that.

  • Matching score for new records added to existing workflow

    Hi SDNers,
    My doubt is:
    I have a 2 Workflows which are already in process. The triggering event for them is Manual, Record Import.
    Now I manually assigned 20 records  to "Workflow A" based on Condition 1
    Also, I manually assigned 20 records  to "Workflow B" based on Condition 2
    I am importing 30 new records. Based on the condition, I want to assign these records to the existing Workflow A / Workflow B.
    Note: There is a Match stencil, so the newly created records have to be matched against the existing records in the present Workflow itself.
    Is it possible to add new records o existing workflow manually?
    Also, what about the Matching score? will the records be matched?
    Thanks & Regards,
    Priti

    Hi Priti,
    I tried restricting records using Named Searhes and Masks but it includes all the records with Match step property Records Vs All. You have to perform some maunal step either by selecting records using some search criteria or you can use Named Searches i.e.
    1. Create one field say New of type boolean and by default set it to NO.
    2. Create one named search for this field value to YES.
    3. Create one assignment which sets the value for this field to YES and add this assignment in the workflow as the first step.
    4. When ever you import records, assignment will set New=YES for all the records imported. Now, when you add more records, search the previous records using Restore Named Search function which will give the list of records imported now. You can perform Matching and Merging operation.
    5. Add one more assignment to the workflow as the last step which should set New=NO so that records should not appear next time for Matching
    Regards,
    Jitesh Talreja

  • Download specific record/columns to Excel

    Is there anyway to download only specific columns or records from a HTMLDB form/report to Excel. The user would need to indicate which records/columns to download.

    Hi Bob,
    to restrict records, just implement a search for the report, to restrict columns just implement checkboxes to view / hide columns of the report by the end user. To do so:
    1. Create Ceckbox e. g. P1_COLUMNS with LOV: STATIC2:Field 1;FIELD1,Field 2;FIELD22. In the Attributes of the Field 1 in Conditional Display, Condition Type: PL/SQL Expression, Expression 1:
    instr(:P1_COLUMNS, 'FIELD1') > 03. Do Step 2. for all other Columns of the report
    4. Optional a Check all / Uncheck All Button which invokes Processes:
    Process Check All, PL/SQL anonymous block:
    :P1_COLUMNS := 'FIELD1:FIELD2:';Process Uncheck All, PL/SQL anonymous block:
    :P1_COLUMNS := '';Regards, Juergen

Maybe you are looking for