How do add a field – DOC with Date type to the Registration table. Also DOC (Date of Completion) should be greater than DOJ (Date of joining). I wrote this query but it is showing error : Column check constraint cannot reference other column Answer Add both the DOC column and the CHECK constraint with a singl…
Tag: oracle
How to remove check constraint?
I am having difficult to remove CHECK using Alter in sql. Can anyone help me please? Answer Oracle does have an alter table … drop constraint syntax for this. But since you created an anonymous constraint, so this is tricky – because you don’t know the name of the constraint. One option is t…
Define a CLOB input parameter for Oracle function (OR Define a function with CLOB input parameter)
I am going to run a code block like below: In which its purpose is to create a function that one of its input argument is CLOB data type. But by executing my code, I get following error: ORA-01704: string literal too long I searched on the internet and also among stackoverflow questions but it didn’t ge…
Maximum mark in Subject with Staff name
Write a query to display list of staff name, subject name handled, maximum mark scored in that subject. Give an alias to the maximum mark as max_mark. Sort the result based on maximum mark in descending. This is the schema diagram. This is the code I have tried. I was abled to pass one testcase but I could no…
Oracle Case Statement Query
I am working on an Oracle Query to find if Diagnostic Pack is installed. Query is working fine. In the Output I need to add another Column Installed. So if currently_used = ‘TRUE’ I need the output to be displayed as below. I am running into an issue with the INSTALLED Column in the case statement…
Generate One year dates using Oracle SQL
I have a table with three ID and Dates i want generate dates of one year from current date and before and after six months Then i want to plot three dates on this one year generated calandar I tried …
Stop Printing double values SQL
Hello Guys! Oracle SQL I am trying to find a way to stop my sql Query print duplicate values. For example Results coming for a table are: The result I want: Thanks in advance! Answer Use DISTINCT to remove duplicate values :
How can I get the months between two dates in Oracle SQL
I need to get the numbers of the months between two dates. For example, between those dates: “03/03/2020 – 06/06/2020” I need something like “(03,04,05,06)”. Answer For Oracle:
Oracle birthday column regex constrain violated
I want all my dates in my database in the following yyyy-mm-dd date format. For example, ‘2020-05-28’. But this doesn’t seem to work as I thought it would when I insert a date into my User table which …
Join on same column multiple times
how do I join on the same column multiple times, one of the tables is a configuration table with values and other is the data table. T1: T2 (Config table): I need to display the code and its relevant description for each ID. Expected Output: This is what I have tried so far, however, it is not giving me the