Before You Begin
This 10 minute tutorial shows you how to create a Quick SQL Shorthand, configure the SQL script, save, and download the Quick SQL script.
This is the last tutorial in Oracle Application Express 18: Quick SQL series. Read the tutorials in sequence.
- Oracle Application Express 18: Quick SQL (1 of 2) - Accessing Samples
- Oracle Application Express 18: Quick SQL (2 of 2) - Creating a Script
Background
Oracle Application Express is a rapid web application development tool for the Oracle Database. Using only a web browser and limited programming experience, you can develop and deploy professional applications that are both fast and secure. Oracle Application Express is available with the Oracle Database, whether it's on-premises or in the Oracle Cloud.
Quick SQL in Oracle Application Express Release 18 is a quick way to develop a script for simple tables and views. You can quickly generate the SQL required to create a relational data model from an indented text document. Quick SQL reduces your time and effort required to create SQL tables, triggers, and index structures.
What Do You Need?
- Complete the preceding tutorial in this series.
- Access to Oracle Application Express Release 18.1 or later.
Create
a SQL Script
You can create simple SQL scripts using the Quick SQL syntax. To create a Quick SQL Shorthand, follow the steps below:
- Sign in to your development environment.
- From the Oracle Application Express home page, click SQL
Workshop.
Description of the illustration sql_workshop.png - Click Utilities.
- Click Quick SQL. The Quick SQL page
appears.
Description of the illustration quicksql.png - Enter the following SQL statement in the Quick SQL Shorthand
pane:
Events /insert 10 name start_date duration /values HALF DAY, FULL DAY, TWO DAY, ONE WEEK location Attendees /insert 100 name company email speaker_yn vc1 /values Y, N
Description of the illustration new_quicksql_shorthand.png Observe the Quick SQL Shorthand. In this code, you are creating two tables:
Events
andAttendees
. TheEvents
table has the following columns:name
start_date
duration
The
duration
column has a list of allowable values.location
The
Attendees
table has the following columns:name
company
email
speaker_yn
The
speaker_yn
column hasY
andN
values.
- Click Generate SQL. The generated SQL
appears in Oracle SQL Output pane. Compare the Quick SQL
script with the corresponding Quick SQL Shorthand. Observe the
Events
table andAttendees
table. The generated script corresponds to the Quick SQL Shorthand values.Description of the illustration generate_sql.png
Configure
Your Quick SQL Script Settings
Configure the Quick SQL settings to explicitly set SQL syntax generation options. To configure Quick SQL settings, follow the steps below:
- On the Quick SQL page, click Settings.
Description of the illustration settings.png - To prefix all databse object names in the script with the
provided value, in the Settings dialog, in the Table region,
enter
MY
in the Object Prefix field. Review other configuration settings by clicking on the Help icon.Description of the illustration object_prefix.png - To add additional columns to automatically add to your
database table, scroll down to the Additional Columns
region and select Audit Columns.
Description of the illustration audit_columns.png - Click Save Changes. Notice the changes.
Description of the illustration saved_settings_script.png
Save
and Download Your Quick SQL Script
You can now save and download the generated Quick SQL script. To save and download your Quick SQL script, follow the steps below:
- Click Save SQL Script.
- In the Save Script dialog, enter
Eventplanning
for the Script Name.Description of the illustration save_name_event.png - Click Save Script. When you click the button, the output is saved as a SQL Script within SQL Workshop. This allows you to run the script into your development environment in a later step.
- You can download your Quick SQL script on your local system.
To download the Quick SQL script, click Download.
Description of the illustration download.png - To review and run your SQL script, click Review and
Run. The Script Editor window appears.
Description of the illustration reviewandrun.png - Review the SQL script and click Run. A Run
Script dialog appears.
Description of the illustration run.png - Click Run Now to proceed. The SQL Scripts
Results page appears with the result.
Description of the illustration sqlscriptresult.png - To see your Quick SQL script, click the SQL Scripts
breadcrumb.
Description of the illustration navigation_sql_scripts.png - On the SQL Scripts page, find your script.
Description of the illustration sql_scripts_list.png