dependent Lov in oracle forms 10g - oracle

I have database block table columns , that has no values means not inserted any values , i have 2 columns in that block order_no,order_name , table name called xx_customer_details, so i need to create LOV on order_no column using oracle table customer_details ,my requirement is i am selecting Order_no vlaues from LOV then need to populate in the order_name column automatically
Thanks

For this, you simply create a RECORD GROUP with the required columns
select order_no,order_name from xx_customer_details;
Now create LOV and assign this record group to it.
In your LOV properties you find Column Mapping properties and map the columns accordingly.
And finally assign this LOV to your text item.
Then you are done.

Related

In Apex how do you create a table where each row of a column is of a different type?

I would like to create a table that looks like this:
As you can see it has three columns, Name, Value, and Unit. Each cell of the Value column is of a different type, first is a radio group, second is a select list, and third is a text field. How do you create such a table in the latest version of Oracle Apex?

Apex 18.1 How to create Multi Column LOV to Return multiple values in multiple columns separately

using Oracle Apex 18.1 and want to have multi-column LOV and return multiple values in columns separately like this will return Department_Id and Manager_Id values in my page items Department_Id and Manager_Id separately.
Well, that's not how Apex LoV works. It must have exactly two values: display and return. Display is what you see, Return is what is actually "stored" into the column. One column, not two (or more) of them.
That's unlike Oracle Forms, which lets you create a LoV that contains many columns and map those values to different form items.
So, what you could try is to use a "Set value" dynamic action and - once you fetch the return value into the item, populate other items on the page.
The way I deal with this is either two LOVs that are parent child.
Set an LOV for departments, and have the second LOV with Managers which takes the department you have as a parameter.
Or I set it up like
SELECT department || ' ' || manager as d
, manager as r
FROM database
And then set up something to fill the department based on the manager chosen.
This assumes the manager is in only one department. I guess you might be able to populate a list with managers who are in multiple departments and then return the PK of the table, and use that return to save into your table.
This might be what you are looking for. Otherwise you might have to make your own.

session item does not change when using lov in primary key

I am implementing a Interactive grid to perform DML operations on a table.
it has combined primary key of two columns
One primary key column is display only and refer to master table and another primary key column I want to have a LOV to select value. LOV is dynamic lov having a display and return value picked from another table.
Inserts are fine but session state item value is set for one row and all the operations are performed on that same row irrespective of which row is selected.
you can see a sample here
https://apex.oracle.com/pls/apex/f?p=128616:2:1964277347439::NO:::
master table name: sample
detail table name: sample_child
primary key in sample child : ID and Name
pop lov is implemented in NAME
LOV values are picked from table: Sample_uncle
LOV display : ID || '-' || NAME
LOV return : ID
you can try to update blabla column of sample_child table to see the issue.
I am not sure how I can give you access to look at the implementation.
I have already tried all the options I can think of
This is to do with your primary keys, the detail table does not appear to have proper ones, thats why it always tried to update the first entry, and I think this is also why every row is marked when you load the table.
Primary keys also do the annoying thing of refusing to be empty, as you can see if you insert a new row, the middle column(which is a PK) is filled with 't1001'.
Since you are dealing with simple tables(and not a whole bunch of joined tables) I always consider it best to use ROWID as PK. So set ROWID as PK for the master table, and ROWID for the detail table. And have the detail table have a Master table be your master table, and then click on the first column in the detail table and set the master column for it. And I also personaly always hide the column that is linked.
I would advise you use ROWID whenever possible as its just so much easier to work with, it does mean you might need to set up a validation to prevent someone adding duplicated values for your actual PK, but since the PK is in the underlying table, they cant enter it anyways(but if you have a validation, the error will be much prettier), whilst if the column is a PK, APEX will prevent duplicates by default.
I hope this helps

How to modify data type in Oracle with existing rows in table

How can I change DATA TYPE of a column from number to varchar2 without deleting the table data?
You can't.
You can, however, create a new column with the new data type, migrate the data, drop the old column, and rename the new column. Something like
ALTER TABLE table_name
ADD( new_column_name varchar2(10) );
UPDATE table_name
SET new_column_name = to_char(old_column_name, <<some format>>);
ALTER TABLE table_name
DROP COLUMN old_column_name;
ALTER TABLE table_name
RENAME COLUMN new_column_name TO old_coulumn_name;
If you have code that depends on the position of the column in the table (which you really shouldn't have), you could rename the table and create a view on the table with the original name of the table that exposes the columns in the order your code expects until you can fix that buggy code.
You have to first deal with the existing rows before you modify the column DATA TYPE.
You could do the following steps:
Add the new column with a new name.
Update the new column from old column.
Drop the old column.
Rename the new column with the old column name.
For example,
alter table t add (col_new varchar2(50));
update t set col_new = to_char(col_old);
alter table t drop column col_old cascade constraints;
alter table t rename column col_new to col_old;
Make sure you re-create any required indexes which you had.
You could also try the CTAS approach, i.e. create table as select. But, the above is safe and preferrable.
The most efficient way is probably to do a CREATE TABLE ... AS SELECT
(CTAS)
alter table table_name modify (column_name VARCHAR2(255));
Since we can't change data type of a column with values, the approach that I was followed as below,
Say the column name you want to change type is 'A' and this can be achieved with SQL developer.
First sort table data by other column (ex: datetime).
Next copy the values of column 'A' and paste to excel file.
Delete values of the column 'A' an commit.
Change the data type and commit.
Again sort table data by previously used column (ex: datetime).
Then paste copied data from excel and commit.

How to add values to a newly added column to all existing rows in Oracle 11g

I want to add a new column in to my production database (11g) that has millions of records but need default value only those existing records, meaning no new records should populate this default value.
Is it possible?
as per my understanding you want to add column to existing table and update it with default value.
alter table table_name add(col_name data_type);
Update table_name set col_name=some_default_value;

Resources