I wrote below FUNCTION to check given data is exist. It is working before but when i add new data on table named iqa_department it suddenly after triggering the function returns me with that error, im kinda new in oracle fom mysql to oracle Here’s how i call it. error i’m getting Answer try this:
Tag: oracle
How to display the related records in a single row in Oracle SQL?
I wrote a query joining two tables and I got a below resultset: However, I need to display below output with one new field called ‘Status’.Mark can work in both the departments and so the count is “2” and the status will be ‘Y’ ( displaying of any one record is okay) . Just…
Conditionally joining from multiple tables
Does SQL allow some form of conditional “table choosing” within the Join statement? ie. selecting a different table to join based on a predefined variable/condition. The error I get when attempting this method is ORA-00905: missing keyword. Answer No. Neither SQL nor Oracle allow this, unless you …
format date in oracle SQL
I was trying to learn how to format date in oracle pl oracle, when I ran below query its returns error Answer for my scenario I had to use to_char which perfectly solve the formatting issue.
SQL Count In Range
How could I count data in range which could be configured Something like this, Table ZONE_CFG is configurable, so I could not use static value for this The DATE column mean maximum date for each ZONE And the result what I expected : Please could someone help me with this Answer You can use LAG and group by as…
What is the correct way of inserting values in to tables and link tables in oracle?
I am currently trying to build a database but have become stuck after creating the tables. I have tried inserting values into a table but it gives me the following error: Error starting at line : 73 in command – Error at Command Line : 73 Column : 66 Error report – SQL Error: ORA-00984: column not…
Sql Query / Calculate rank for values based on date and id
For each date and id we have to give the rank to values in decreasing order. Below is the Input Table. Output should look like below: Answer You can use RANK(), partitioning on date and id and ordering by value descending: Output: Demo on SQLFiddle This query will run on all the DBMS you have tagged your ques…
Counting rows in different tables and grouping by a certain criteria
I have 3 tables: Projects, Components, Suppliers. Each one has an id column, city column and some other columns. What I am trying to do is count how many projects, components and suppliers there are for each city. What I have tried is: After running this query, I am getting incorrect values, almost all of the…
How to bind variable in string in SQL query?
I am using SQL Developer. When I want to bind value. Normally I use following syntax: but, I don’t know how to do that in string. The following query does not work. Why do I need it? Because my program runs a query in python and assigns something to bind variable: Answer Concatenate the prefix/suffix wi…
Correction Needed for error in Oracle query
I want calculate the all students credit hours separately group by stduents of each? needed help to correction of query Answer Try this: