Sub topic 2
FreeSQL: SQL in the browser with no install
This chapter assumes you can write basic SQL (SELECT, INSERT, CREATE TABLE) and know what a client-server database is. You don't need Docker or an Oracle Cloud account for this chapter. FreeSQL is the lowest-effort option of the three, so it is the best place to start.
By the end you will be able to:
- Explain what FreeSQL is and which parts of a normal Oracle workflow it replaces.
- Run single statements and multi-statement scripts in it.
- Write scripts that can be re-run safely.
- Say what you give up compared with a database you connect to yourself.
What FreeSQL is
FreeSQL is a website run by Oracle where you type SQL and run it against a real Oracle Database. The database runs on Oracle's servers. Your browser is the only client. There is no listener to reach, no password to set for SYS, no wallet to download, and no container to start.
It replaces the Oracle Live SQL site, so older tutorials may point to Live SQL. If you see a link to it, look for FreeSQL instead.
FreeSQL has three parts that matter for practice:
- An editor and results area. You write SQL on one side and see query output, errors and script output on the other.
- A personal schema. Your statements run in a database schema (a named set of objects such as tables and views) that belongs to your session or your account.
- A library of examples and tutorials. These are scripts you can open, run and modify. They are useful for seeing new syntax without setting anything up.
The exact layout and the Oracle Database release behind it change over time. Check the site's own help text for the current release. Don't rely on the version number you saw in a tutorial.
Where it fits among the three options
| Aspect | FreeSQL | 26ai Free in a container | Always Free Autonomous Database |
|---|---|---|---|
| Setup effort | Open a page | Install a container runtime, pull an image, wait for first start | Create a cloud account and provision a database |
| Control | Very low. You get a SQL editor only | High. You are `SYS` and `SYSTEM` | Medium. You are `ADMIN` in a managed service |
| Connect from other tools | No | Yes, port 1521 | Yes, with TLS or a wallet |
| Persistence | Limited to what the site keeps for you | Lasts as long as the container and its storage | Lasts while the database exists and is not reclaimed |
| Typical use | Trying syntax, learning, sharing a snippet | Local development and testing | Cloud-hosted practice and small apps |
The sections below explain why FreeSQL lands where it does in this table.
Getting started
- Open the FreeSQL site in a current browser.
- Pick the editor (the worksheet) and type a statement.
- Run it with the Run button or the keyboard shortcut shown next to it.
Signing in with an Oracle account is optional for trying statements. It matters when you want to keep your work. Saved scripts, and anything you want to come back to later, are tied to the account. Without sign-in, assume your work disappears when you close the tab.
A first statement:
SELECT sys_context('USERENV', 'SESSION_USER') AS session_user,
sys_context('USERENV', 'CON_NAME') AS container_name
FROM dual;SYS_CONTEXT('USERENV', ...) returns facts about your session. The first value is the schema you are working as. In FreeSQL it will be a generated, non-administrative user, not SYS or ADMIN. That already tells you something: you are a plain schema owner, as you would be in a well-run development database.
Running a statement versus running a script
FreeSQL, like other Oracle tools, treats two cases differently.
- Run statement. Executes the one statement under the cursor, or the selected text. Results show as a grid.
- Run script. Executes everything in the editor, statement by statement, and prints output as text. Errors appear next to the statement that caused them, and the script usually carries on after an error.
That last behavior surprises people. If statement 3 of 10 fails, statements 4 to 10 still run, and some of them may depend on statement 3. When a script produces confusing errors, read the first error and ignore the later ones.
Separators matter in a script. End each SQL statement with a semicolon. A PL/SQL block ends with END; followed by a line containing only /. A missing / is the most common reason a script appears to hang or to swallow the statements after a block.
BEGIN
DBMS_OUTPUT.PUT_LINE('Hello from PL/SQL');
END;
/If DBMS_OUTPUT text does not appear, look for an output or console panel in the interface. Some tools only show it when that panel is open.
Write scripts you can run again
Because a FreeSQL session is disposable, you will run the same script many times. A script that fails on its second run because the table already exists wastes your time. Make scripts idempotent: running them twice gives the same result as running them once.
Oracle Database 23ai and later support DROP TABLE IF EXISTS, so the cleanup is one line:
DROP TABLE IF EXISTS practice_note PURGE;
CREATE TABLE practice_note (
id NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
body VARCHAR2(200) NOT NULL,
created_at TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL
);
INSERT INTO practice_note (body) VALUES ('Hello from FreeSQL');
INSERT INTO practice_note (body) VALUES ('Second row');
COMMIT;
SELECT id, body
FROM practice_note
ORDER BY id;Points to notice:
PURGEskips the recycle bin, so the dropped table does not linger under a system-generated name.GENERATED ALWAYS AS IDENTITYcreates an auto-numbered column. You cannot insert a value into it. If you try, Oracle raises an error.COMMITends the transaction. Without it, other sessions cannot see your rows, and a rollback or session end discards them. The editor may or may not commit for you, so be explicit.
If the database release behind the site is older and rejects IF EXISTS, use a PL/SQL block that ignores error ORA-00942 (table or view does not exist):
BEGIN
EXECUTE IMMEDIATE 'DROP TABLE practice_note PURGE';
EXCEPTION
WHEN OTHERS THEN
IF SQLCODE != -942 THEN
RAISE;
END IF;
END;
/The RAISE matters. Without it the block would hide every other error too, such as missing privileges.
Saving, reopening and sharing
Signed in, you can save a script under a name and open it again later. Saved scripts are the durable part of FreeSQL. The tables you create while testing are not the thing to rely on.
Use this pattern:
- Keep the whole setup in the script: drop, create, insert, query.
- Save the script.
- When you return, run the script again to rebuild the data.
Scripts can also be shared by link. Treat anything you share as public. Don't put real names, real customer data, passwords or internal table designs in a script you plan to share.
The same pattern gives you a cheap way to ask for help. A script that rebuilds the problem from nothing, with a few sample rows, is far easier for someone else to run than a description. Reduce the problem to the smallest script that still fails, then share that.
How it works behind the scenes
You don't need these details to use FreeSQL, but they explain its limits.
- Your statements travel over HTTPS to a web service, which runs them in the database and returns results. You never open a database network connection yourself.
- Because the service runs the statement for you, it can enforce limits on run time, on result size and on how much you can store.
- The generated user has only the privileges needed to create ordinary objects. It cannot create other users, change system settings or read other people's schemas.
What you give up
The limits follow from the design. Expect these differences from a database you own:
- No client connections. You cannot connect SQL*Plus, SQLcl, SQL Developer, Python's
python-oracledbor a JDBC application to it. If an exercise says "connect your application," FreeSQL is the wrong place. - No administrator work. You cannot create users, grant roles to others, change initialization parameters, look at
V$performance views that need extra privileges, or practice backup and recovery. - Restricted features. Calls out to the network, access to files on the database server, and some packages are blocked or limited.
- Limits on time and size. Long-running statements are cut off. Large data loads may be refused. Check the site's current limits before you plan a big exercise.
- Uncertain persistence. Without an account, expect to lose your objects. With an account, keep the setup scripts anyway.
These limits make FreeSQL good for learning SQL syntax and poor for learning database administration or application connectivity.
Typical workflow
Common problems
| Symptom | Likely cause | What to do |
|---|---|---|
| `ORA-00955: name is already used by an existing object` | The script was run twice and the table already exists | Add a `DROP TABLE IF EXISTS` line at the top |
| `ORA-00942: table or view does not exist` | The `CREATE TABLE` failed earlier, or the session was reset | Scroll to the first error in the script output |
| `ORA-32795: cannot insert into a generated always identity column` | You listed the identity column in the `INSERT` | Remove the column from the column list |
| A script seems to stop partway | A PL/SQL block is missing its `/` line | Add `/` on its own line after `END;` |
| Rows vanish between runs | The data was never committed, or the session ended | Add `COMMIT` and rebuild data from the saved script |
Syntax errors give an ORA-00900 series message or a PLS- code with a line and column. Count lines from the top of the statement, not the top of the script, when the position looks wrong.
When FreeSQL is the right choice
Choose FreeSQL when your goal is one of these:
- Trying a SQL feature, such as window functions,
JSON_TABLEorMERGE, in a minute. - Following a SQL tutorial that needs nothing but a schema.
- Making a small, shareable example for a question or a code review.
- Working on a machine where you cannot install software.
Choose another option when you need to connect an application, create several users, practice privileges and roles, or keep data for weeks. The next chapters cover the container and Autonomous Database for those cases.
Exercise
Your script creates a table, inserts two rows, and queries them. The first run works. The second run prints ORA-00955 for the CREATE TABLE statement, then shows four rows in the final query, and you expected two. What happened, and what is the smallest change that makes the script safe to rerun?
Show answer
The table survived from the first run, so CREATE TABLE failed with ORA-00955, but the script continued and the INSERT statements added two more rows to the existing table, giving four. Add DROP TABLE IF EXISTS practice_note PURGE; (or the PL/SQL equivalent that ignores ORA-00942 on older releases) before the CREATE TABLE so every run starts from an empty state.
Exercise
A colleague asks whether you can use FreeSQL to test that your Python application can connect to Oracle with python-oracledb. What do you answer, and which option would you suggest?
Show answer
No. FreeSQL has no network endpoint for client drivers; you can only run SQL through the website. Use Oracle Database 26ai Free in a container, which exposes port 1521, or an Always Free Autonomous Database, which accepts connections over TLS or with a wallet.