Oracle Flags
Validation
In the
name of Allah, Most Gracious, Most Merciful
Praise
be to Allah, blessing and peace be upon our prophet Mohammed, his family and
his companions. After that,
Flags are useful in Oracle form validations. It's value can be stored into the database or it can be handled from form side. It can be represented in many different forms e.g. a checked box, a radio box or a static drop down list.
Task Definition:
Validate a database flag.
Task Solution:
One way to handle flag validation is to
create a program unit of type function
to return the stored value of flag from
Oracle database table.
you can customize the
returned value from your flag according to the notation you pre-determined for your application business logic.
The following function
returns a single value of the stored database flag. There are two or more possible values e.g. (1 or 0) Or (Y or N) but what we concern of is
to get the current value of the selected flag according to the given
condition in the database.
Then, we can raise an exception or change some item properties
to validate user in-put.
FUNCTION Validate_Flag RETURN BOOLEAN IS
v_flage NUMBER;
BEGIN
BEGIN
SELECT your_db_flg
INTO v_flage
FROM table_name
WHERE -- conditions--- ;
EXCEPTION
WHEN NO_DATA_FOUND THEN RETURN NULL;
END;
IF v_flage = 1
THEN
RETURN TRUE;
ELSIF v_flage = 0
THEN
RETURN FALSE;
END IF;
END;
Hence, the returned Boolean value from the program unit is just
for the validation process. It has nothing nothing to do with the actual value
of the database flag. Here is an example to reveal such a confussion.
Learn more about:
Hope this helps...
My success only comes from Allah, pls. note your comments and
suggestions are great help for me in progress thanks in advance
No comments :
Post a Comment