I am using ORACLE SQL* PLUS XE 11g. I made a Vehicles table with: And added data with: Note: Original code consists of many columns Now to print data in this table on terminal, I used This printed the table in a unordered format. I hope you know what I mean. Something like this: To solve this issue, I used
Tag: oracle11g
Inserting data into table with select
i`m trying to do something…. I have to insert some data in to a table but….. So here is where I end up… any suggestion… Answer You cannot refer to an alias in the SELECT or WHERE clauses of a sub-query where it is defined. Generate the data in a sub-query (or a sub-query factoring clause) and then refer to
Searching for a string in a column
I need to show the results from this column where Product_name column contains ‘Documentation’ or ‘documentation’ in a result. The query must return a result regardless of whether the word is in lowercase or uppercase https://i.stack.imgur.com/bjLuY.png I found this solution, any suggestions Answer
Compare two VAT numbers
I`m trying to list only the vat numbers which look like DDDDDDDDDLLDDDD else i have to list NULL https://i.stack.imgur.com/4PYR8.png Pretty sure that I`m close but still missing something 🙁 Answer You can use the regular expression ^d{9}[A-Z]{2}d{4}$ to match the start-of-the-string, then any 9 digits, then any 2 upper-case letters, then any 4 digits and, finally, the end-of-the-string: If you
Is it possible to have a nested where and and clause in oracle sql?
I’ve tried search for this and I’m not sure I’m using the correct terminology, but is it possible to have a nested WHERE AND clause?: So the nested AND would “and (age != 18 and hair_colour != black)” so you could have: first_name = ‘Jay’ evaluate to true last_name = ‘McDonald’ evaluate to true (age = 18 and hair_colour =
Get first row that is null in Oracle DB table
I have the following table rownum ID date owner 1 1 09/01/2022 null 2 1 09/02/2022 null 3 1 09/03/2022 Joe 4 1 09/04/2022 null 5 1 09/05/2022 Jack 6 2 09/01/2022 null 7 2 09/02/2022 John 8 2 09/02/2022 John 9 2 09/02/2022 John For every ID, I want to select the first occurrence of null that eventually results
Get all employee detail from employees table whose “First_name” start with any single character between ‘a-p’
is there any new way to rewrite the SQL Query to find the first_name starting from A to P Answer Use regexp_like: The regex breakdown: ^ means “start of text” [a-p] means “any character in the range à to p inclusive” The i flag means “ignore case”
Is there a way to terminate the insert query in a trigger?
I wonder is it able to terminate or stop the Insert if it hits the exceptions. The trigger coding will be: Answer This is how I understood it; though, it is not clear what UPDATE TABLE in your code represents. Update which table? How? With which values? Anyway: sample data: Trigger: Testing:
ORA-00937: not a single-group group function Workaround
This is my query which produces this error: ORA-00937: not a single-group group function Expected result for the last column – first order of every customer: I know that I have to use GROUP BY clause to handle this error, but it seems rather inappropriate to group by all the other columns.. I know that this is a limitation in
Not able to create a matrix in PL/SQL using nested tables
I was trying to create a matrix in PL/SQL using nested tables as such: firstly, I create a table type that is able to store varchars (that in my case is name lista_principala) secondly, using the previously declare table type lista_principala I try to create a table type that contains items of type lista_principala. I don’t think that I’m wrong