Query regarding PL/SQL - oracle

I have table named CUST where CUSTNO field is primary key and its data type is number. I have created a view on top of the table where also CUSTNO field is showing as NOT NULLABLE in attribute list of view. But when I am explicitly typecasting this CUSTNO column to string inside view, the column is showing as NULLABLE in view attribute list. Is there any way to keep this field as NON NULLABLE even after typecasting in view? I am using Oracle 12c database.

Related

How to save the data in a different column instead of replacing the data in same column

I have one field on my form (field example name "completion_date"). This data is stored to table column "completion_date". When users edits the detail, data is overwritten in the backend table field as a default way of storing the data. How can I pass on the existing data in this column to a new column (completion_date_a) when the user saves a new date in the field.
One option is to create a database trigger, e.g.
create or replace trigger trg_bu_date
before update on your_table
for each row
begin
:new.completion_date_a := :old.completion_date;
end;
/
Littlefoots' answer is correct, but you could also do this in apex with very little work. Suppose your form items are P1_COMPLETION_DATE and P1_COMPLETION_DATE_A, both mapped to their respective database column. P1_COMPLETION_DATE_A is hidden. Add a computation to P1_COMPLETION_DATE_A with point "After Header" and type "Item". Pick P1_COMPLETION_DATE as item.
Now when you save the form, the value of P1_COMPLETION_DATE_A will be set to the value of P1_COMPLETION_DATE when it was selected.

skip the particular column for insert in entity framework

I have a default value in Database. When I was inserting a new record, that time I need to avoid the default value column in the entity.
For Example:
CreatedDate Default value in database
but in my UI I need to avoid the column CreatedDate for Inserting time

why there is always some null values when I use "insert into" in hive?

I created a table and define the data type of every field which is the same with the source table. When I use "insert into table select ..." to fulfill data in this new table, there is no debug error. And I am sure the 'productid' field has no null value in source table which is bigint type. But after the inserting, I find a little amount of records' productid is null. I also try stored as textfile and parquet. It makes no sense that there is still null values in outcome table.
However, when I use "creata table as select .... from ...", there is no null in the outcome productid.
So I don't know where is the problem?
Thanks.
This happens mostly when the actual data which you are trying to load have different datatype than destination Hive table column data type in DDL OR if length is smaller in target table. Check productid missing value in terms of actual data in it and length Vs defined in DDL statement.

Oracle Apex Tabular Form Data Lost

I have a Tabular Form in my Oracle Apex application. There is a column as UPDATED_DATE. I have set Tabular Form Attributes of this column as below.
When i'm inserting data, UPDATED_DATE column in database table is filling with a value. But when i'm updating existing record, UPDATED_DATE column is not filling with a new value. old date is remaining without changing to a newer data.
How can i solve this ?
The default will only set a value if the field is empty. On your first entry the field is empty, and therefore the updated_Date is set. On updating, the field is allready set, and therefore won't be updated.
You need to create a dynamic action (assuming you use apex 4 or above) and use that to update the date field. Your dynamic action should be triggerd on change of an table row and subsequently set the date field to the current date.
Let me now if you need help on the dynamic action.

representation format in web2py database

db.define_table('person', Field('name'), format='%(name)s')
What does this format do here?
The format argument is used to determine how fields in other tables that reference the 'person' table will be displayed. For example, if you define:
db.define_table('dog',
Field('name'),
Field('owner', db.person)
The 'owner' field is a reference field that references the 'person' table (i.e., it stores record id's of records from the 'person' table). In most cases, when you display data from the 'dog' table, you don't want to display the raw db.person record id that is stored in the 'owner' field because that doesn't have any meaning -- instead, it makes more sense to display the 'name' of the person. In web2py, the format attribute of the table enables this automatic substitution in both forms and tables.
When you create a SQLFORM based on the 'dog' table, it will automatically generate a drop-down list for the 'owner' field, and because of the format='%(name)s' argument to the 'person' table definition, the drop-down list will display db.person names instead of record id's (even though upon form submission, the 'owner' field will store the associated record id rather than the name).
Also, if you display records from the 'dog' table in a SQLTABLE or SQLFORM.grid, the 'owner' field will show the owner's name rather than the owner's record id.
See http://web2py.com/books/default/chapter/29/6#Record-representation.

Resources