Forms :: How To Stop From Inserting If Condition Not Met
Feb 7, 2010
I have master detail datablocks. Master block is course and detail block is trainee. students can schedule their courses in a location at particular time.
lets assume student1 has scheduled course A1 in location LA1 from 9am to 12 pm. Now second student shouldn't be able to schedule same course at same time in same location. He can schedule at different time duration. or else same time duration but different location. Or same time, same location but different course.
so, what i did is, i wrote code in when-validate-record of trainee block to display a message saying " cannot schedule course.choose another time." if he try to insert same time duration or same location .
when i am trying to insert a record with time which is already scheduled and in same location, it displays the message but it is also saving the record. i don't want to save the record.
how should i do this? i tried to give ROLLBACK in this trigger but it doesn't accept. i tried pre-insert trigger also but it is also displaying message but saving the record
my code in when-validate-record is:
declare
cursor c1 is
select start_time,end_time,loc
from trainee
where cname=:course.cname;
[code].......
How Can We Stop to insert Data if Master Block have the record and detail block have no record but commit command applied i want that commit command can not be work if detail block have no record
how to stop going to next record if it finds the last record. Because when i click my next button(it is the last record), i try to click my previous or first button but it won't go back, enter-query mode is the error message.
I have a form with multiple data block. When i want to query and go to next record then this displayed a message "Do you want save changes". But i would like to stop this message(i.e would not see the message) is it possible.
I have master detail block just consider Forms A as a master and Forms B as a Detail,when my cursor is in form A i try to save the record, it is saved Form A and putting Form B data as null, i have to put a validation to stop this activity, i have to inform the user "Provide values for form B text item",
I created a post block trigger in form A
Begin
If (:FORM-B.TEXT1 is null)l or( :FORM-B.TEXT2 is null) then Message( 'provide value for FORM-B'); Message( 'provide value for FORM-B'); raise form_trigger_failure; ELSE NULL; END IF END;
Im Getting error message and navigation got stopped in last item of form A itself,i need to show error message and cursor control should move to first item of form -B which trigger i have to use for this.
I'm uploading data from excel to our database using forms thru webutil. The problem is when I open the same excel file while the upload process is in progress, the uploading stops, BUT not displaying any error. Not even when I chick Help->Show error.
How could I prevent this error and how to trap and display error message?
I have problem with the form when i pass from the master to detail block the form stop working and it stops responding even if i am in the next detail block and i press tab to change from one record to another the form will say working and it stops responding.
I have a form that has one text box in it, and I want this value to be inserted into a table called Staff Name, which has only one column, but im unsure as to how I would get my SQL statement to pick up this value.
I tried:
begin insert into StaffName values ('addstaffmember'); end;
Add staff member is the name of the text box. this statement compiled but when I ran the form and tried to click save it would not work.
I have created a datablock and set up the user interface to allow the users to insert all the data they need, however my table has some fields which should be generated automatically and are not done through user input:
id - which is uniqe to each entry to the table so is gernerate by a sequence (which I created on the database) but when i put seq.nextval into the initial value on the datablock it says i cannot do this, so how do I use the sequence to insert the value into that field in the database. This is my primary key in my database whichobviosuly my users cant input data to, instead it is generated automatically.
User - similarly in the datablock is a user field which states the user that inserted that record, I know on the database i can put DEFAULT user for that field , but how do I make the user insert automatically through forms.
Date - Similarly again how do I set SYSDATE to be automatically input to the date field when the user submits the record?
I am facing a problem while inserting primary keys using a sequence. Following is my case
I have a Master Table, say M_A, and 2 detail tables D_1 and D_2. I am trying to generate primary keys for the master and detail table as well as the reference keys for the detail tables using sequence.
I created a pre-insert trigger, say preInsertTRIG
proc_ABC(pri_key_master OUT VARCHAR2, pri_key_detail1 OUT VARCHAR2, fk_detail1 OUT VARCHAR2, pri_key_detail2 OUT VARCHAR2, [Code] ........
I am able to insert the P.K of the master table as well as P.K of one of the detail table. However, it fails to insert the P.K of 2nd detail table and reference keys for both the detail tables. I know there are other simple methods available in Forms, but I have to do it by this procedure only
I am working on forms 6i. I have set where condition in pre-query of a trigger, my requirement is, in post-query, i want to delete the where condition.
pre-query:
set_block_property('HEADER_S',default_where,'STATUS IN (select meaning from XXSMCQSS_LOOKUP_VALUES where lookup_type=''CONCESSION STATUS CODES'' and primary_flag=''N'' )');
post_query: I want to delete this where condition, i just want make execute query normal by removing the where condition.
how can i insert a image by selecting an image from any drives of my system to oracle database and retriving that image for displaying purpose after inserting that image. if possible give me a sample form. like vb 6.0 or vb.net in textbox's change trigger fires instantly when we start typeing in the text boxes.
I have Multi record Block and for that block i have created one button, if we press that buttion it will open new block and it will post the records, Unfourtunately that block table dont have Primary key or any constraints .. so when we press that buttoon multiple times .. its posting multiple times..
Now i need to restrict to that which is should not post the records multiple timies i have tried by controling the paraemter..I have created one Non data base item initially value i assigned to 'N"
if the value is "N" then am doing process and showing the records and after processing am assigning the value to 'Y', if there are multiple records , at block level in pre-record trigger am assigning as 'N'.
how to read the excel data and insert into tables without using SQL loader. i tried using OLE2 package,but i am getting an non-oracle exception. even i tried using CSV format. but i couldn't make it.
If i enter something in FIND window, by clicking FIND button, it will populate data in MAIN window.I have below query in WHEN BUTTON PRESSED TRIGGER.
declare cursor c1 is select empno, ename, job, sal from emp where empno=nvl(:FIND.empno,empno) and ename=nvl(:FIND.ename,ename)
begin --here i am populating data into MAIN window block end;
It's working fine.
REQUIREMENT: i want to pass where statement dynamically. Let us say if i pass only empno in FIND window, i want to pass 'WHERE empno=:FIND.empno' to existing select statement [I will keep select statement same without where condition]
If i pass empno and ename both, i want to pass 'WHERE empno=:FIND.empno and ename=:FIND.ename.
How to pass where condition to existing select statement based on parameters we pass in FIND window.
In form i call a record from database table through execute_query. i have lov on ITEM_NO
i want to display on that form, no. of records of ITEM_NO which i select from the list. like if i have 10 records with item_no which i select from list is must show 1/10.
if i press the down arrow it should show next record of the same item_no.
I'm using forms 9i. Let's say I have a Block in the form B1. It has two items I1 and I2. I have a table called T1 that has a column say C1. The data in the only record in T1 is 'NAME_IN(''B1.I1'') = 1 OR NAME_IN(''B1.I2'') = 2'..In forms I need to execute the following at POST-QUERY trigger of the block:-
DECLARE VAR1 VARCHAR2(1000); BEGIN SELECT C1 INTO VAR1 FROM T1; [code]....
As you could see that the IF statement is wrong. But I get the condition (for IF condition) as a string value from some database table.
,i have a table called travel detail from which i have retrieved few rows based on 1 condition by using LOV and on next few rows modification is allowed. The rows are getting modified but it is also allowing me to enter in next blank row and insert any data in that row.how can i retrieve only that data which is based on the given condition. Further blank rows should not b displayed.
I got a form with few columns and a check_box. If the user selects n number of check boxes and click the button Save. The corresponding records should be inserted to XX_AP_CUSTOM table.
I have written the following below code in when-button-pressed trigger. With this i am able to insert only one record i.e where the current record indicator is there, even though multiple check-boxes(records) are selected.
declare
begin IF :XXFBI_INV_QUOTE_ANAL_BLK.CHECK_BOX = 'Yes' THEN --IF CHECKBOX_CHECKED(:XXFBI_INV_QUOTE_ANAL_BLK.CHECK_BOX) = TRUE Then --app_insert.insert_record('WHEN-BUTTON-PRESSED'); insert into xxfbi.XXFBI_INV_QUOTE_ANAL(Item,
[code]......
I know that i have to use last_record and first_record and for loop to insert multiple selected records, but dont know how to do it.
I'm trying to create a relation from child block to the master block that I've created . Foreighn key is there from child to parent table.The error I get is below:
FRM-15004: Error while parsing join condition
The join condition is correct, but I'm still clueless as to what it could be.Is it a form bug?
i want to update record that is fetched based on join condition on form
1. made a block manually :::: EMPSAL 2. Query DATA SOURCE NAME :::: EMP a, Sal b 3. Where Clause :::: a.empid = b.empid 4. DML DATA Target Type :::: Table 5. DML DATA Target Name :::: EMP a, Sal b 6. All Columns are marked a.empid, a.empname, b.sal, b.date etc
I receive a "FRM-15004 Error while parsing join condition" when attempting to create a relation between block1 (parent table) and block2 (child table). If I do a simple straight join the statement is accepted but if I use a Decode then it results in an error. How to successfully use a decode or a nvl in a join statement of a relation?