I’m trying to write a PL-SQL query to return records from multiple table and using decode to allow null value comparison, The result is returning only where DeptName is exactly matching to the database values, but I want a query to return something e.Department like ‘%DeptName%’ Answer No need for anything other than boolean logic: If you want a NULL
Tag: oracle-sqldeveloper
UPDATE TABLE SQL Missing expression error
Error: 00000 – “missing expression” Why doesn’t this work? Answer Remove the table prefixes and the extra *. Careful with updates without a where clause, as they will update all the records from your table.
Oracle SQL combining table information and creating output
I have two tables in Oracle SQL developer and I am trying to figure out how to display “fname, ssn” and the employees corresponding manager “fname, snn”. Below are the tables that I have created but I cant seem to get the employee information to correspond to their subsequent manager. Employee Table Department Table Desired Output This is what I
Oracle SQL REGEXP to fetch the last numeric value in a string
I have the below string value in a column and I need to extract the last numeric value. I have used SUBSTR(ColumnA, -1, 1), but this is extracting only the last digit. ColumnA 12_23_AB245-F5 66_78_HJ378-G5567 55_16_GC761-B99898 Below is the expected result ColumnA 5 5567 99898 Answer Use REGEXP_SUBSTR here with the pattern [0-9]+$: Demo
how to drop multiple functions in Oracle
I want to drop multiple functions from my database at a time in Oracle’s SQL developer. Is anyone has an idea how to create a script for that? Answer Well, the static option to drop the functions (sometimes considered more secure as you can double-check what you are removing) consist of two steps 1 – run the following query 2
SQL Developer forces capitalization when I create a table
When I create a table with SQL Developer my columns and the name of the table must be capitalized. I want to use lower case but I don’t know how to do it. Answer This is not something that SQL Developer does; it is done by the Oracle database and is the default behaviour. From Oracle’s Database Object Names and
Grouping the common values in Oracle
I have a table with sample values as below In this table, all the values in Col1 will have its supporting values in Col2. The values A1 and A2 are like master values and they will never appear in Col2. I need to make an output displaying this master values in a new column like below What would be the
Oracle SQL Inserting multiple rows into a table while referencing 2 FK
I’m trying to insert values id_team_FK and id_location_FK which both come from the same table. For example id_team_FK = 4 and id_location_FK = 150. The problem is, id_team_FK must be a randomly chosen …
query inside the exception and begin block in exception
Hello I want to ask what is the best practise to do. First example try to retrieve my data through exceptions I use this code in my main application and is working fine but I dont know if its good practise to code inside the exceptions blocks SECOND EXAMPLE TRY TO RETRIEVE DATA WITH CASES AND SELECT WITH COUNT. Answer
Why selecting a single attribute returns less rows than selecting all columns in oracle SQL
The tables created and the queries made are not the primary focus of this question, what confuses me is that why the first query and the second query returns different numbers of rows I want to find the sid of the sailors who have not ordered all the red boats, the first query above returns the correct rows I am