Skip to content
Advertisement

Tag: plsql

plsql parameterised cursor in which the parameter is user input

here’s my cursor statement and call like this The variable countryName is declared along with the cursors, and this query runs fine but no data is fetched. no idea what I’m missing here.. Answer With some sample data like below: A_TBL ID COL_A COL_B IE 01-NOV-22 1 UK 02-NOV-22 2 FR 03-NOV-22 3 IT 04-NOV-22 4 this code works… Did

Oracle chr() diferent returns from SQL engine versus PL/SQL engine, why?

Same function, same argument, different outputs: PL/SQL procedure successfully completed. Answer In your case, chr() appears to be performing an implicit conversion to binary_float (IEEE 754 floating-point representation) as the datatype, as opposed to number (ANSI SQL NUMERIC). This results in different rounding results. I cannot duplicate your results on 19c unless I force the datatype, in which case I

Oracle SQL – Create Sequence and add sequence values on new column

I have the following table called table_1 I create a new column_3 then I create a sequence CREATE SEQUENCE “sequence_1” MINVALUE 1 MAXVALUE 9999999999999999999999999999 INCREMENT BY 1 START WITH 1 CACHE 20 NOORDER NOCYCLE NOPARTITION and I alter the table_1 so the default for new values on column_3 are the the values of the sequence. ALTER TABLE table_1 MODIFY column_3

Year, Next Year, Quarter e Next Quarter based in a FISCAL YEAR

I need to bring the results of this SQL showing all the data of “MY FISCAL YEAR” that started in 1st june, and other SQL to showing all the data of the “NEXT FISCAL YEAR”, because I made it based on the database calendar. btw, the last fiscal year ended in 31 MAY The user will sent the request with

PL/SQL table mutation and trigger Format

I just started with triggers, I want the trigger to give me the msg error if the new tauxHoraire is 50% greater than the current tauxHoraire (so *1.5 >). The trigger compiles but I’m getting ORA-04091: table name is mutating, trigger/function may not see it. There might a problem in how I wrote it. Or is the problem somewhere else?

pl/SQL for loop

i having an issue on changing the month according to the loop in where the clause i have used between function the month of todate function have to be changed according to the loop if a becomes 1 then the month in where clause has to be changed according to 1 if a becomes 2 the month have be changed

Oracle SQL Trigger not getting created

I have a table passenger as shown below I am learning triggers and I want to create a trigger that updates charges as charges + 100 before a new insert is done. Here is the trigger I created. However, I am getting the error ORA-04079: invalid trigger specification. I have tried replacing new with :new, adding begin & end blocks,

SQL query optimisation by replacing subquery

The following query works and gives me the expected result but i’d like to optimise it. Is there a way to avoid the subquery, using only the conditions in the main query to arrive at the same result: PS: In PLSQL, NVL function lets us substitute a value when a null value is encountered Thanks for any input Answer A

Advertisement