Skip to content

Commit

Permalink
Add blog on Oracle database commands
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi committed Jan 13, 2024
1 parent e322b0f commit e424db2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/blog/2020-08-28-oracle-programming/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ FROM dba_tables;
You will get the following error message if you don't have access to the `dba_tables` view:
```
```bash
ORA-00942: table or view does not exist
```
Expand All @@ -181,14 +181,14 @@ view, or `SELECT ANY DICTIONARY` privilege, or `SELECT_CATALOG_ROLE` privilege.
#### [Comparing Dates](https://stackoverflow.com/a/34061999)
```
```sql
Select count(*) From Employee
Where to_char(employee_date_hired, 'YYYMMMDDD') > 19940620
```
or
```
```sql
Select count(*) From Employee
employee_date_hired > TO_DATE('20-06-1994', 'DD-MM-YYYY');
```
Expand All @@ -197,15 +197,15 @@ employee_date_hired > TO_DATE('20-06-1994', 'DD-MM-YYYY');
The 'l' command will show the last run command
```
```sql
SQL> l
1* select owner, count(1) from dba_tables group by owner
SQL>
```
To get more than that, turn on history
```
```sql
SQL> set history on
SQL> history
1 select * from dual;
Expand All @@ -215,7 +215,7 @@ SQL> history
#### [Get A List of All Tables](https://stackoverflow.com/a/205746)
```
```sql
SELECT OWNER, TABLE_NAME
FROM DBA_TABLES;
```
Expand All @@ -229,7 +229,7 @@ of Oracle tables that you probably don't care about.
Alternatively, if you do not have access to `DBA_TABLES`, you can see all the tables that your account has access to
through the `ALL_TABLES` view:
```
```sql
SELECT OWNER, TABLE_NAME
FROM ALL_TABLES;
```
Expand All @@ -239,7 +239,7 @@ the tables that your user has been granted access to).
If you are only concerned with the tables that you own, not those that you have access to, you could use `USER_TABLES`:
```
```sql
SELECT TABLE_NAME
FROM USER_TABLES;
```
Expand Down

0 comments on commit e424db2

Please sign in to comment.