if i click a button the last value in id should be incremented and displayed in the textbox in windows application(.net).
eg..
in database there are 10 records... in the column id from 1 to 10... if i click the button
the value should be increment and 11 should be shown in my textbox in windows application..
please send as soon as possibe
You need to specify that the ID column in your DB is an "identity" column. Then, when you insert a new record into the table, SQL will automatically assign the new record with the previous highest value in that column incremented appropriately (you can have SQL increment by 1 or more if you wish).
David Hayden wrote up a nice little article on this very subjectlink text:
http://www.davidhayden.com/blog/dave/archive/2006/02/16/2803.aspx
Related
I am disabling past dates in Date Picker in Apex v4.1 by entering in Setting as Minimum Date +0d
But when I am trying to edit and save data next day that field is showing error. Can somebody please help.
I can't view images, but - the way you described it - I'd suggest you to remove +0d in Date Picker item and create your own validation whose type is PL/SQL Function returning error text; it will check whether item value is equal or larger than TRUNC(SYSDATE), e.g.
if :P1_DATE_ITEM < trunc(sysdate) then
return ('Error - date has to be larger or equal to today''s date');
end if;
Then set validation's server side condition to e.g. ITEM IS NULL, while the "item" is table's primary key item (or - if you're working with the ROWID - use it).
Doing so, you'd tell Apex to perform control only for newly created rows (because their primary key column value isn't set yet, nor it has a ROWID as row isn't saved into the database). "Old" rows have it and validation won't fire.
I have table with three columns x (Foreign Key),y(Primary Key),z and also csv file with only two columns data y,z as shown in images http://imgur.com/a/12ENZ (Please copy and paste link)which has to uploaded into table.Here I fill x column for all the rows with constant value ‘20’.i have used Data loading wizard to do this in Apex 5.
Problem:
In the first step I loaded this table and then In next step you can see that I have to do column mapping .Here I get only two columns y(Mileage),z(Ratio) because I have only two columns in the excel and first column x i want to map with null values here(Problem 1).
In the next step I have added process in the Datavalidation to update column x to fill that constant value as shown in images. But you could see p_attr_number =1 makes first column to be updated with 20 value.Here I need my first column x to be filled with constant value 20(Problem 2).Please Give me some suggestions on this for solving this problems.
for problem 1 you can choose x column as nullable yes by editing your colum in object browser -> your table -> modify column -> nullabe field to NULL (do not reguire a value) so when you upload data it will not fill third column if you map 2 columns (althıugh you do not see the column name in wizards)
for problem 2 i am assuming that all fields in your database has data so you you can add a page process for giving new values to the uploaded data which has null x columns
1 go to 4th page 'Data Load Results' which created by data wizard
2 click add a page process button
3 choose pl/sql
4 give a name and choose on submit - after computations and validations
5 enter an update command which suits your needs as below
update your_table_name
set
x=20
where x is null;
6 write your success messages
7 choose finish button in option "when button presses"
8 create process
9 add a Branch button in Branches
10 give a name click next
11 enter the page you want to go after data load
12 choose finish button in option "when button presses"
13 go to finish button and choose submit in Action When Button Clicked -> action
by adding this process and branch
1st system will insert data to table
2nd it will update all the null x values to the static values in your table
3rd it will return to the page you want
Oracle >> How to count the no of lines entered in a cell in table, because i want to restrict maximum line for a customer. friends kindly give some suggestions to execute this command with SQL and PL/SQL..
Create a validation on that page that runs when query exists.
Add this query changing P1_item with the name of your page item:
SELECT 1 from dual where length(:P1_item) - length(REPLACE(:P1_item, chr(10), ''))>10
Using this when you submit the page if there are more than 10 new lines in your page item the validation will popup an error.
I am developping a web application in Oracle Application Express (Apex) technology.
I have a page where I can add a new record to a table called 'tz_tab'. That table has a column 'pos' which is one letter (single char) - 'Y' or 'N'. Now, i'd like to do something like this:
When post processing (== updating/inserting 'tz_tab') form on the page - check if 'pos' value is 'Y'
If so - update the rest of records in 'tz_tab' values to 'N'
I tried creating triggers on 'tz_table' but with no success.
Summing up, I need to have only one record with 'pos' value == 'T' in 'tz_tab'.
Is there any method to do this by APEX or should it be done with oracle triggers?
Thanks!
It sounds like you can achieve this by creating a PL/SQL process in your APEX page that will fire after submit. You should be able to check page items and perform an UPDATE statement as required.
You don't say how you're doing your processing in Apex, but you can create a page process that fires after your insert/update step with something like.
UPDATE tz_table SET pos = 'N' WHERE id != :ID_OF_THE_ITEM_JUST_UPDATED
I have a LOV with two columns one is code and the other is description. I know that text items have a property which says validate from list however my code field and description field are display items. We do not want to force the user to click on a button to show the LOV. In the pre-form trigger i am setting a default value in the code field.
I would like to get/resolve the code to its description from the list without having to do a select from the database. Does anyone know of a way to get this done?
I have had also this very same problem. There might not be a solution to retrieve the label column from record group in the runtime.
But you could do this:
Store the record group query somewhere (package header or DB column).
Populate your record group with query in the runtime.
Create DB function which takes query and key value as parameters. The function would then return description of the key value (use dynamic SQL, execute immediate / dbms_sql).
Use the function in the POST-QUERY trigger:
:block.item_description := your_new_function(l_query, :block.item_value);