Tuesday, April 12, 2022

Important Topics

 Inline Query: An inline query is a query that is defined in the FROM clause. Inline views can contain multiple columns.

Sub Query: A Subquery or Inner query or Nested query is a query within another SQL query and embedded within the WHERE clause. Subqueries (in the Oracle meaning) should return only one.

1. In which language has Oracle been developed?

Oracle has been developed using C Language.

2. What is the Difference between varchar and varchar2 data types?

Varchar can store up to 2000 bytes, and varchar2 can store up to 32672 bytes. Varchar will occupy space for NULL values, and Varchar2 will not occupy any space. Both differ with respect to space.

 3. What is a RAW datatype?

RAW datatype is used to store values in binary data format. The maximum size for a raw in a table in 32767 bytes.

4. What is the use of the NVL and NVL2 functions?

The NVL function replaces NULL values with another or given value.

The NVL2 function will take 3 arguments NVL2('A', 'B',' C' ). It will check the first value. If it is not null, then it will return the second value. If it is null, then it will return the Third value.

NULLIF function takes two argument values. If both are exactly the same, then it will return a NULL value. If both values are not the same, then it will return the first value. If the first value is null, then it will return an error. If the second argument is null, then it will return the First value.

5. What is COALESCE function?

The coalesce function takes any number of argument values and will return the first, not the null value. COALESCE function is used to return the value which is set to be not null in the list. If all values in the list are null, then the coalesce function will return NULL.

Coalesce(value1, value2,value3,…)

6. What is DML?

Data Manipulation Language (DML) is used to access and manipulate data in the existing objects.  DML statements are insert, select, update and delete and it won’t implicitly commit the current transaction.

7. What is the difference between TRANSLATE and REPLACE?

Translate is used for character by character substitution and Replace is used substitute a single character with a word.

8. What is the usage of Merge Statement?

Merge statement is used to select rows from one or more data source for updating and insertion into a table or a view. It is used to combine multiple operations. Actually merge is the combination of two DML statement Insert & Update.

Error Log table create Package:

BEGIN
DBMS_ERRLOG.CREATE_ERROR_LOG(dml_table_name=>'EMPLOYEE_SALARY_PROCESS',err_log_table_name=>'EMPLOYEE_SALARY_PROCESS_ERROR');
END;
INSERT INTO EMPLOYEE_SALARY_PROCESS SELECT * FROM EMPLOYEE_SALARY_PROCESS_TEMP 

9. What is a sub query and what are the different types of subqueries?

Sub Query is also called as Nested Query or Inner Query which is used to get data from multiple tables. A sub query is added in the where clause of the main query.

There are two different types of subqueries:

  • Correlated sub query

A Correlated sub query cannot be as independent query but can reference column in a table listed in the from list of the outer query.

  • Non-Correlated subquery

This can be evaluated as if it were an independent query. Results of the sub query are submitted to the main query or parent query.

10. What is cross join?

Cross join is defined as the Cartesian product of records from the tables present in the join. Cross join will produce result which combines each row from the first table with the each row from the second table. 

11. What are temporal data types in Oracle?

Oracle provides following temporal data types:

  • Date Data Type – Different formats of Dates
  • TimeStamp Data Type – Different formats of Time Stamp
  • Interval Data Type – Interval between dates and time

12. How do we create privileges in Oracle?

A privilege is nothing but right to execute an SQL query or to access another user object. Privilege can be given as system privilege or user privilege.

[sql]GRANT user1 TO user2 WITH MANAGER OPTION;[/sql]

13. What is VArray?

Description the varray (variable size array) is one of the three types of collections in PL/SQL (assosiated array, nested table, varray). VArray is an oracle data type used to have columns containing multivalued attributes and it can hold bounded array of values.

Collection: A collection is an ordered group of logically realated elements. In a collection the internal component always have the same datatype, and are called elements.

Records: In a records the internal components always have different data types, and are called fields.

14. How do we get field details of a table?

Describe <Table_Name> is used to get the field details of a specified table.

15. What is the difference between rename and alias?

Rename is a permanent name given to a table or a column whereas Alias is a temporary name given to a table or column. Rename is nothing but replacement of name and Alias is an alternate name of the table or column.

16. What is a View?

View is a logical table based on other base tables or views. Views will not have data of his own,It has typically  fetch data of his underlying base table or view. Views contains no data itself (except materialized view). There are two types of view .

1. Simple view : Simple view created based on single table without having aggregrate column,Distinct keyword. DML operation is allowed in simple view.
2. Complex view: Complex view created based on any number of tables. It can contain aggregrate column,distinct keyword or pseudocolumn. No DML operation allowed.

By using WITH READ ONLY constraints we are not able to operation any DML on the view.
Syntex: create or replace view v_emp as select * from emp with read only;

By using WITH CHECK OPTION CONSTRAINTS we can restrict a view to process the dml operation. Suppose I have create a view based on emp table where department is CSE and I want only CSE department's data will be changed. For this we can create view with check option.
Syntex: create or replace view v_emp as select * from emp where department='CSE' with check option;

View recompile : If view is going under Invalid status then need to recompile view.There are three way to compile view .one is -Alter view view_name compile; another one is to recreate view. Beside this if we call the view then it will try to compile view.


Different between View and Materialized view :

View is just a named query. It soesn't store anything. when there is a query on view, it runs the of the view defination. Actually data comes form table. no need to refresh data.

Materialized view stores data physically and get updated periodically. While querying MV, it gives data from MV. Need to refresh seperately.

17. What are SET operators?

SET operators are used with two or more queries and those operators are Union, Union All, Intersect and Minus.

 Union : UNION operator is used to combine the result sets of 2 or more Oracle SELECT statements. It removes duplicate rows between the various SELECT statements. Each SELECT statement within the UNION operator must have the same number of fields in the result sets with similar data types.Union will remove duplicate and sort the data.

Union ALL: 
If you want to retain the duplicate rows, you explicitly use UNION ALL.Union will not remove duplicate and will not sort the data.

Intersect :The intersect of T1 and T2 result returns 2 and 3. Because these are distinct values that are output by both queries. The following picture illustrates the intersection of T1 and T2:

Oracle INTERSECT

The illustration showed that the INTERSECT returns the intersection of two circles (or sets).

Minus : The Oracle MINUS operator compares two queries and returns distinct rows from the first query that are not output by the second query. In other words, the MINUS operator subtracts one result set from another.

The following picture illustrates the result of the MINUS of T1 and T2:

Oracle MINUS


18. How can we delete duplicate rows in a table?

Duplicate rows in the table can be deleted by using ROWID.

19. What is an integrity constraint?

An integrity constraint is a declaration defined a business rule for a table column. Integrity constraints are used to ensure accuracy and consistency of data in a database. There are types – Domain Integrity, Referential Integrity and Domain Integrity.

20. What are the various constraints used in Oracle?

Following are constraints used:

  • NULL – It is to indicate that particular column can contain NULL values
  • NOT NULL – It is to indicate that particular column cannot contain NULL values
  • CHECK – Validate that values in the given column to meet the specific criteria
  • DEFAULT – It is to indicate the value is assigned to default value

21. What is difference between SUBSTR and INSTR?

SUBSTR returns specific portion of a string and INSTR provides character position in which a pattern is found in a string.

SUBSTR returns string whereas INSTR returns numeric.

22. What is the parameter mode that can be passed to a procedure?

IN, OUT and INOUT are the modes of parameters that can be passed to a procedure.

23. What are the different Oracle Database objects?

There are different data objects in Oracle –

  • Tables – set of elements organized in vertical and horizontal
  • Views  – Virtual table derived from one or more tables
  • Indexes – Performance tuning method for processing the records
  • Synonyms – Alias name for tables
  • Sequences – Multiple users generate unique numbers
  • Tablespaces – Logical storage unit in Oracle

24. What are the differences between LOV and List Item?

LOV is property whereas list items are considered as single item. List of items is set to be a collection of list of items. A list item can have only one column, LOV can have one or more columns.

25. What is the maximum number of triggers that can be applied to a single table?

A trigger is a PL/SQL block structure which is automatically fired when an event occurs in the database. 12 is the maximum number of triggers that can be applied to a single table.

There ar 5 types of trigger.
1.DML Triggger
2.DDL Trigger
3. SYSTEM Trigger
4.Insted of trigger 
5. Compound Trigger

There are 2 types of DML trigger in oracle. 
1.Row level Trigger
    1.Insert (Before,After)
    2.Update (Before After)
    3.Delete (Before, After)
2.Statement Level trigger:
    
1.Insert (Before,After)
    2.Update (Before After)
    3.Delete (Before, After)

Trigger Execution Order:
    1.Before Statement level trigger
    2.Before Row level trigger
    3.After Row level trigger
    4.After Statement Level trigger

26. What is the data type of DUAL table?

The DUAL table is a one-column table present in oracle database.  The table has a single VARCHAR2(1) column called DUMMY which has a value of ‘X’.

27. What is difference between Cartesian Join and Cross Join?

There are no differences between the join. Cartesian and Cross joins are same. Cross join gives cartesian product of two tables – Rows from first table is multiplied with another table which is called cartesian product.

Cross join without where clause gives Cartesian product.

28. What types of joins are used in writing subqueries?

Join is used to compare and combine, this means literally join and return specific rows of data from two or more tables in a database.

There are three types of joins in SQL that are used to write the subqueries.

  • Self Join: This is a join in which a table is joined with itself, especially when the table has a foreign key which references its own primary key.
  • Outer Join: An outer join helps to find and returns matching data and some dissimilar data from tables.
  • Equi-join: An equijoin is a join with a join condition containing an equality operator. An equijoin returns only the rows that have equivalent values for the specified columns.
29. Where do you use DECODE and CASE Statements?

Both these statements Decode and Case will work similar to the if-then-else statement and also they are the alternatives for each of them. These functions are used in Oracle for data value transformation.

30. What is SQL and also describe types of SQL statements?

SQL stands for Structured Query Language. SQL is used to communicate with the server in order to access, manipulate and control data. There are 5 different types of SQL statements available. They are:

  1. Select: Data Retrieval
  2. Insert, Update, Delete, Merge: Data Manipulation Language (DML)
  3. Create, Alter, Drop, Rename, Truncate: Data Definition Language (DDL)
  4. Commit, Rollback, Savepoint: Transaction Control Statements
  5. Grant, Revoke: Data Control Language (DCL)
31. What are the data types available in PL/SQL?

There are two data types available in PL/SQL. They are namely:

  • Scalar data types
    Example: Char, Varchar, Boolean, etc.
  • Composite datatypes
    Example: Record, Collection (VARRAY,Nested Table & Associated Table).
  • REF Cursor : REF cursor is oracle Data Type. REF cursor are used for dynamic SQL. We will be able to dynamically assign a different and completely different set of SQL at runtime.

32. What are the uses of a database trigger

Triggers are the programs which are automatically executed when some events occur:

  • Implement complex security authorizations.
  • Drive column values.
  • Maintain duplicate tables.
  • Implement complex business rules.
  • Bring transparency in log events. 
33. Explain the difference between Triggers and Constraints?

Triggers are very different from Constraints in the following ways:

TriggersConstraints
Only affect those rows added after the
 trigger is enabled
Affect all rows of the table including that 
already exist when the constraint is enabled
Triggers are used to implement complex
 business rules which cannot be
 implemented using integrity constraints
Constraints maintain the integrity of the
 database

34. Exception handling in PL/SQL

An error is an abnormal termination during a normal execution of the program. When an error occurs in PL/SQL, the corresponding exception is raised. This also means, to handle undesired situations where PL/SQL scripts gets terminated unexpectedly, error-handling code is included in the program. In PL/SQL, all exception handling code is placed in the Exception section.

There are 3 types of Exceptions:

  • Predefined Exceptions: Common errors with predefined names.
  • Undefined Exceptions: Less common errors with no predefined names.
  • User-defined Exceptions: Do not cause runtime error but violate business rules.
35.  What is the difference between COUNT (*), COUNT (expression), COUNT (distinct expression)?

COUNT (*): This returns a number of rows in a table including the duplicates rows and the rows containing null values in the columns.
COUNT (EXP): This returns the number of non-null values in the column identified by an expression.
COUNT (DISTINCT EXP): It returns the number of unique, non-null values in the column identified by an expression.

36. List out the difference between Commit, Rollback, and Savepoint?

The major differences between these are listed below:

  • Commit: This ends the current transaction by ensuring that all pending data changes are made permanent.
  • Rollback: This ends the current transaction by discarding or deleting all pending data changes.
  • Savepoint: It divides a transaction into smaller parts. You can rollback the transaction until you find a particular named savepoint.
37. How will you differentiate between VARCHAR & VARCHAR2?

Answer: Both VARCHAR & VARCHAR2 are Oracle data types that are used to store character strings of variable length. Their differences are:

  • VARCHAR can store characters up to 2000 bytes while VARCHAR2 can store up to 4000 bytes.
  • VARCHAR will hold the space for characters defined during declaration even if all of them are not used whereas VARCHAR2 will release the unused space.
38.  What is the difference between TRUNCATE & DELETE command?

Answer: Both the commands are used to remove data from the database.

The difference between the two include:

  • TRUNCATE is a DDL operation while DELETE is a DML operation.
  • TRUNCATE  removes all the rows but leaves the table structure intact. It can not be rolled back as it issues COMMIT before and after the command execution while the DELETE command can be rolled back.
  • The TRUNCATE command will free the object storage space while the DELETE command does not.
  • TRUNCATE is faster compared to DELETE.

40. How does the ON-DELETE-CASCADE statement work?

Answer: Using ON DELETE CASCADE will automatically delete a record in the child table when the same is deleted from the parent table. This statement can be used with Foreign Keys.

We can add ON DELETE CASCADE option on an existing table using the below set of commands.

41. What is a trigger and what are its types?

Answer: A trigger is a stored program which is written in such a way that it gets executed automatically when some event occurs. This event can be any DML or a DDL operation.

PL/SQL supports two types of triggers:

  • Row Level
  • Statement Level

 Row Level Triggers

 Statement Level Triggers

Row level triggers executes once 
for each and every row in the
transaction.

Statement level triggers executes
only once for each single
transaction. 

Specifically used for data
auditing purpose.

Used for enforcing all additional
security on the transactions
performed on the table. 

“FOR EACH ROW” clause is
present in CREATE TRIGGER
command.

“FOR EACH ROW” clause is omitted in
CREATE TRIGGER command.

Example: If 1500 rows are to be
inserted into a table, the row
level trigger would execute 1500
times.

Example: If 1500 rows are to be
inserted into a table, the
statement level trigger would
execute only once. 

42. How will you distinguish a global variable with a local variable in PL/SQL?

Answer: Global variable is the one, which is defined at the beginning of the program and survives until the end. It can be accessed by any methods or procedures within the program, while the access to the local variable is limited to the procedure or method where it is declared.

42. What are the packages in PL SQL?

Answer: A package is a group of related database objects like stored procs, functions, types, triggers, cursors, etc. that are stored in the Oracle database. It is a kind of library of related objects which can be accessed by multiple applications if permitted.

PL/SQL Package structure consists of 2 parts: package specification & package body.

PL/SQL Package Benefits: Summary

This article lists key benefits provided by PL/SQL packages for PL/SQL subprograms over standalone procedures and functions. These are:

  • Organized code management (Logically group the related subprograms,object and variable)
  • Easy (top-down) application design
  • Easy changes to implementation
  • Security and maintainability (Security of code through implementation of private subprograms)
  • Session-wide persistence of variables
  • Better berformance ( Enter packages is loaded into memory when the package is first referenced, There is only one copy of the package in the memory for all users.)
  • Overloading (Overloading of subprograms are only possible within package)

Monday, April 11, 2022

Database Normalization with Example

 

Database Normal Forms :

Database Normalization: Normalization is the process of splitting or organizing data to reduce redundancy and avoid data anomalies.

Here is a list of Normal Forms in SQL:

  • 1NF (First Normal Form)
  • 2NF (Second Normal Form)
  • 3NF (Third Normal Form)
  • BCNF (Boyce-Codd Normal Form)
  • 4NF (Fourth Normal Form)
  • 5NF (Fifth Normal Form)
  • 6NF (Sixth Normal Form)

However, in most practical applications, normalization achieves its best in the 3rd Normal Form. The evolution of Normalization in SQL theories is illustrated below-

Database Normal Forms
Database Normal Forms

Database Normalization With Examples

Database Normalization Example can be easily understood with the help of a case study. Assume a video library maintains a database of movies rented out. Without any normalization in the database, all information is stored in one table, as shown below. Let’s understand the Normalization database with a normalization example with a solution:

Database Normalization With Example

Here you see the Movies Rented column has multiple values. Now let’s move into 1st Normal Forms:


1NF (First Normal Form) Rules: No multivalue attribute.

  • Each table cell should contain a single value.
  • Each record needs to be unique.

The above table in 1NF-

1NF Example :

Example of 1NF in DBMS

Example of 1NF in DBMS


2NF (Second Normal Form) Rules :

  • Rule 1- Be in 1NF
  • Rule 2- Single Column Primary Key that does not functionally dependent on any subset of candidate key relation

It is clear that we can’t move forward to make our simple database in 2nd Normalization form unless we partition the table above.


2NF Example


2NF Example in DBMS

We have divided our 1NF table into two tables viz. Table 1 and Table2. Table 1 contains member information. Table 2 contains information on movies rented.

We have introduced a new column called Membership_id which is the primary key for table 1. Records can be uniquely identified in Table 1 using membership id.


3NF (Third Normal Form) Rules :

  • Rule 1- Be in 2NF
  • Rule 2- Has no transitive functional dependencies

To move our 2NF table into 3NF, we again need to again divide our table.

3NF Example :

Below is a 3NF example in an SQL database:


3NF Example


3NF Example


Example of 3NF in Database


We have again divided our tables and created a new table which stores Salutations.

There are no transitive functional dependencies, and hence our table is in 3NF

In Table 3 Salutation ID is primary key, and in Table 1 Salutation ID is foreign to primary key in Table 3


What are transitive functional dependencies?

A transitive functional dependency is when changing a non-key column, might cause any of the other non-key columns to change

Consider the table 1. Changing the non-key column Full Name may change Salutation.


Transitive functional dependencies in Database


BCNF (Boyce-Codd Normal Form)

Even when a database is in 3rd Normal Form, still there would be anomalies resulted if it has more than one Candidate Key.

Sometimes is BCNF is also referred as 3.5 Normal Form.

4NF (Fourth Normal Form) Rules

If no database table instance contains two or more, independent and multivalued data describing the relevant entity, then it is in 4th Normal Form.

5NF (Fifth Normal Form) Rules

A table is in 5th Normal Form only if it is in 4NF and it cannot be decomposed into any number of smaller tables without loss of data.

6NF (Sixth Normal Form) Proposed

6th Normal Form is not standardized, yet however, it is being discussed by database experts for some time. Hopefully, we would have a clear & standardized definition for 6th Normal Form in the near future…

That’s all to SQL Normalization!!!

Summary

  • Database designing is critical to the successful implementation of a database management system that meets the data requirements of an enterprise system.
  • Normalization in DBMS is a process which helps produce database systems that are cost-effective and have better security models.
  • Functional dependencies are a very important component of the normalize data process
  • Most database systems are normalized database up to the third normal forms in DBMS.
  • A primary key uniquely identifies are record in a Table and cannot be null
  • A foreign key helps connect table and references a primary key

TRIGGERS IN ORACLE FORMS

 Triggers are blocks of PL/SQL code that are written to perform tasks when a specific event occurs within an application. In effect, an Oracle Forms trigger is an event-handler written in PL/SQL to augment (or occasionally replace) the default processing behavior. Every trigger has a name, and contains one or more PL/SQL statements. A trigger encapsulates PL/SQL code so that it can be associated with an event and executed and maintained as a distinct object. There are different level trigger in oracle forms.

Block Processing Triggers: Block processing triggers fire in response to events related to record management in a block.

  • When-Create-Record Perform an action whenever Oracle Forms attempts to create a new record in a block.
  • When-Clear-Block Perform an action whenever Oracle Forms flushes the current block; that is, removes all records from the block.
  • When-Database-Record Perform an action whenever Oracle Forms changes a record’s status to Insert or Update, thus indicating that the record should be processed by the next COMMIT_FORM operation.

Master/Detail Triggers: Oracle Forms generates master/detail triggers automatically when a master/detail relation is defined between blocks.

  • On-Check-Delete-Master Fires when Oracle Forms attempts to delete a record in a block that is a master block in a master/detail relation.
  • On-Clear-Details Fires when Oracle Forms needs to clear records in a block that is a detail block in a master/detail relation because those records no longer correspond to the current record in the master block.
  • On-Populate-Details Fires when Oracle Forms needs to fetch records into a block that is the detail block in a master/detail relation so that detail records are synchronized with the current record in the master block.

Message-Handling Triggers:

Oracle Forms automatically issues appropriate error and informational messages in response to runtime events. Message handling triggers fire in response to these default messaging events.
  • On-Error Replace a default error message with a custom error message, or to trap and recover from an error.
  • On-Message To trap and respond to a message; for example, to replace a default message issued by Oracle Forms with a custom message.

Query-Time Triggers:

Query-time triggers fire just before and just after the operator or the application executes a query in a block.
  • Pre-Query Validate the current query criteria or provide additional query criteria programmatically, just before sending the SELECT statement to the database.
  • Post-Query Perform an action after fetching a record, such as looking up values in other tables based on a value in the current record. Fires once for each record fetched into the block.

Interface Event Triggers:

Interface events trigger fire in response to events that occur in the form interface. Some of these triggers, such as When-Button-Pressed, fire only in response to operator input or manipulation. Others, like When-Window-Activated, can fire in response to both operator input and programmatic control.
  • When-Button-Pressed Initiate an action when an operator selects a button, either with the mouse or through keyboard selection.
  • When-Checkbox-Changed Initiate an action when the operator toggles the state of a check box, either with the mouse or through keyboard selection.
  • When-Image-Activated Initiate an action whenever the operator double-clicks an image item.
  • When-Image-Pressed Initiate an action whenever an operator clicks on an image item.
  • When-Radio-Changed Initiate an action when an operator changes the current radio button selected in a radio group item.
  • When-Window-Activated Initiate an action whenever an operator or the application activates a window.
  • When-Window-Closed Initiate an action whenever an operator closes a window with the window manager’s Close command.
  • When-Window-Deactivated Initiate an action whenever a window is deactivated as a result of another window becoming the active window.

Transactional Triggers:

Transactional triggers fire in response to a wide variety of events that occur as a form interacts with the data source.
  • On-Delete
  • On-Insert
  • On-Update
  • On-Logon
  • On-Logout
  • Post-Database-Commit
  • Post-Delete
  • Post-Insert
  • Post-Update
  • Pre-Commit
  • Pre-Delete
  • Pre-Insert
  • Pre-Update

Navigational Triggers:

Navigational triggers fire in response to navigational events. Navigational triggers can be further sub-divided into two categories: Pre- and Post- triggers and When-New-Instance triggers. Pre- and Post- Triggers fire as Oracle Forms navigates internally through different levels of the object hierarchy. When-New-Instance-Triggers fire at the end of a navigational sequence that places the input focus on a different item.
  • Pre-Form Perform an action just before Oracle Forms navigates to the form from “outside” the form, such as at form startup.
  • Pre-Block Perform an action before Oracle Forms navigates to the block level from the form level.
  • Pre-Record Perform an action before Oracle Forms navigates to the record level from the block level.
  • Pre-Text-Item Perform an action before Oracle Forms navigates to a text item from the record level.
  • Post-Text-Item Manipulate an item when Oracle Forms leaves a text item and navigates to the record level.
  • Post-Record Manipulate a record when Oracle Forms leaves a record and navigates to the block level.
  • Post-Block Manipulate the current record when Oracle Forms leaves a block and navigates to the form level.
  • Post-Form Perform an action before Oracle Forms navigates to “outside” the form, such as when exiting the form.
  • When-New-Form-Instance Perform an action at form start-up. (Occurs after the Pre-Form trigger fires).
  • When-New-Block-Instance Perform an action immediately after the input focus moves to an item in a block other than the block that previously had input focus.
  • When-New-Record-Instance Perform an action immediately after the input focus moves to an item in a different record.
  • When-New-Item-Instance Perform an action immediately after the input focus moves to a different item. 

Validation Triggers:

Validation triggers fire when Oracle Forms validates data in an item or record. Oracle Forms performs validation checks during navigation that occur in response to operator input, programmatic control, or default processing, such as a Commit operation.
  • When-Validate-Item
  • When-Validate-Record
What is the difference between CALL_FORM, NEW_FORM, and OPEN_FORM?

CALL_FORM: It starts a new form and passes control to it. It will open the requested form by keeping the parent form active but hidden.
New_Form: It' terminates the current form and replaces it with the indicated new form.
Open_form: It opens the indicated new form without replacing or suspending the parent form.

What are the sequences of firing triggers in forms?

The sequence of firing triggers in forms When forms open is

  • Pre-form
  • Pre-block
  • Pre-recorded
  • Pre-text-item
  • When-new-form-instance
  • When-new-block-instance
  • When-new-record-instance
  • When-new-item-instance

What is the canvas in oracle forms?

A canvas is a layer within a window where visual objects like interface items or graphics can be placed. Oracle forms support four types of canvas, as mentioned below:
    1. Content Canvas (Default)
    2. Tab Canvas
    3. Toolbar Canvas
    4. Stacked Canvas
Name the different triggers associated with Oracle Forms having a master-detail relationship.
The enlisted trigger gets created during the creation of the master-detail block:

  • ON-CHECK-DELETE-MASTER
  • ON-CLEAR-DETAILS
  • ON-POPULATE-DETAILS

Various types of reports include:

  • Tabular
  • Group Left
  • Group Above
  • Matrix-Minimum 4 Groups are required
  • Matrix with Group
  • Form Reports
  • Form Letter Reports
  • Mailing Labels Reports

There are three types of columns in Oracle reports. They are:

  • Formula Columns: Columns that can do user-defined calculations on values within other columns and return some value. Formula columns are used to calculate information dynamically.
  • Summary Columns: Columns can do summary computations like sum, average, etc. on values placed in the other columns.-Used for calculating summary information.
  • Placeholder Columns: Column for which data type or value can be set using PL/SQL.Used to hold some values at runtime.
Report trigger & execution sequence:
    1. Before parameter form
    2. After parameter form
    3. Before report
    4. Between Page
    5. After report

Monday, November 15, 2021

Login User Image Display on Navigation Menu In Oracle Apex


1
.Create application item name > 'IMAGE_ID',> Session State Protection > Unrestricted.

2.Create Application Processes > 'GETIMAGE',> Process Point > Ajax Callback, > PL/SQL Code >

begin for c1 in (select * from employee_information where unique_id = :IMAGE_ID) loop sys.htp.init; sys.owa_util.mime_header( c1.MIME_TYPE, FALSE ); sys.htp.p('Content-length: ' || sys.dbms_lob.getlength( c1.PICTURE)); sys.htp.p('Content-Disposition: attachment; filename="' || c1.FILENAME || '"' ); sys.htp.p('Cache-Control: max-age=3600'); -- tell the browser to cache for one hour, adjust as necessary sys.owa_util.http_header_close; sys.wpg_docload.download_file( c1.PICTURE); apex_application.stop_apex_engine; end loop; end;

3.Create/Select navigation bar where you want to show image > User Defined Attributes 1.

<img style="width:25px;height:25px;border-radius:50%;cornflowerblue" src="f?p=&APP_ID.:0:&APP_SESSION.:APPLICATION_PROCESS=GETIMAGE:::IMAGE_ID:&APP_USER." alt=" ">

Tuesday, November 9, 2021

Oracle Apex 21.2 Installation & ORDS Configuration


 1.@apexins.sql sysaux sysaux temp /i/

2.@apxchpwd.sql

3.@apex_rest_config.sql

4. Unlock All Locked User :      select username,account_status from dba_users  where username like 'APEX%';
select username,account_status from dba_users  where username like  'ORDS%';
or

select username,account_status from dba_users where lock_date is not null and username like 'APEX%'; )

For Oracle Database version 12c or later run the below script:

BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
host => '*',
ace => xs$ace_type(privilege_list => xs$name_list('connect'),
principal_name => 'APEX_210100',
principal_type => xs_acl.ptype_db));
END;
/ BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
host => 'localhost',
ace => xs$ace_type(privilege_list => xs$name_list('connect'),
principal_name => 'APEX_210100',
principal_type => xs_acl.ptype_db));
END;
/ EXEC DBMS_XDB.sethttpport(0);


#unzip ords file :

    copy the images folder from the apex directory and paste it to ords folder.

Download Link :
jdk-https://www.oracle.com/java/technologies/javase-downloads.html

Ords-https://www.oracle.com/database/technologies/appdev/rest-data-services-v192-downloads.html

Ords Run Command:

Set path=C:\Program Files\Java\jdk-18.0.2.1\bin
java -jar ords.war serve
java -jar ords.war --config  D:\Oracle\ords\config serve

Internal User Unlock & Password change:

First need to log in Oracle sys user.

SELECT TO_CHAR(user_id),
first_name,USER_NAME,
last_name,
default_schema
FROM wwv_flow_fnd_user
WHERE user_name = 'ADMIN'
ORDER BY last_update_date DESC;

ALTER SESSION SET CURRENT_SCHEMA = APEX_190200;

begin
wwv_flow_security.g_security_group_id := 10;
wwv_flow_fnd_user_api.UNLOCK_ACCOUNT('ADMIN');
commit;
end;

UPDATE wwv_flow_fnd_user
SET web_password = 'Enter your password'
WHERE user_name = 'ADMIN'
AND user_id =1200348866127291;

What's New in Oracle APEX 21.2


 1. Smart Filters : Smart Filters is a new search component that allows users to quickly narrow data down with filters suggestions or search items. In Smart Filters include -Powerful Search Bar, Search Suggestions, Suggestion Chips.

2.Progressive Web Apps : APEX apps can easily be defined as Progressive Web Apps (PWAs) to take advantage of advanced caching and improved performance. These apps can also be installed on  smartphone of choice with device-specific installation instructions. Progressive Web Apps Include-
App Performance, Apex Application Instable, Custom Offline Page.

3. Universal Theme & UI Updates : The updated Reference App now provides live Template Option previews, documented CSS variables, and a new Theme Version menu in the header to quickly jump to Reference Apps for previous versions of the Universal Theme. New updates are- Greater Flexibility in Page Layouts, Model Dialog Drawers, Accessibility Improvements, Faster Page Rendering.

4. New & Updated Components :
    1.Faceted Search Enhancements : Multi-Value Facets, Additional UI Controls, 
        Accessibility Improvements.

    2. Update Alert and Confirm Dialogs : Customizable Dialogs, Support for Template Directives, Button Confirmation.

5.Geocoding and Map Items : Geocoding your addresses has never been easier, and you can even display a map as a page item . The best part is that you don't need an API key.

6.REST Catalogs and Improvements : 
    1. Search Catalogs Across Apps.
    2. Easy Export and Import.
    3.URL-based Updating.
    4. Pagination Support for REST Services.

7. Improved Report Downloads, Subscriptions, and Printing :
    1. Images in Report Downloads.
    2. Download Dialog Improvements.
    3.Interactive Report Subscriptions.

8. Developer Experience :
    1.Improved Editors :Static File Editor, Improved Breadcrumb Editor, Run Larger SQL in SQL Commands (SQL Commands now supports  more than 32k characters).

9. Email and Email Template Enhancements :
    1. Email Support in Automations.
    2.Copy Email Templates.
    3. Inline Email Attachments.

10. Additional Features :
    1.Data Packager.
    2. Popup LOV Set Display Value.
    3. New Date Picker 'Show-On' attribute.
    4. New Modal Dialog Event.
    5.Copyright Banner in App Exports.
    6.New PL/SQL APIs.
    7. New JavaScript APIs.
    8.Build Apex Apps in 21 additional Language.
    9. JavaScript Library Upgrades.


Oracle Apex Uninstall Process


Oracle Apex Uninstall : 

First we need to go to Apex Folder & Connect Database Using SQL Plus Or  CMD.
Then Execute These Command:  @apxremov_con.sql                                                 OR @apxremov.sql


Image File store outside of Oracle Database and show image into Apex Application

Directory Create : grant execute on utl_file to HRMS; CREATE OR REPLACE DIRECTORY STOCK_DIRECTORY AS 'C:\Program Files (x86)\Apache Sof...