r/plsql • • Oct 31 '21

help? not sure why i am not getting anything out of this.

2 Upvotes

Here is my code. i dont have any errors but the final test case doesn't seem to select any rows?? i come to you all to figure out if I have a syntax issue or a placement problem in the code.

EDIT 1: took out the og code as I figured out my original issue.

EDIT: figured that out now I am having another issue attempting to change it into an autonomous transaction like this

AUTHID CURRENT_USER IS

PRAGMA AUTONOMUS_TRANSACTION;

however I am getting this error

PLS-00127: Pragma AUTONOMUS_TRANSACTION is not a supported pragma


r/plsql • • Oct 19 '21

simple question regarding body

2 Upvotes

What doesn't require a body during creation? Package, procedure, function or trigger? I personally don't think its trigger as that has nothing to do with a body.


r/plsql • • Jul 05 '21

SQL Developer Vendor Code 1033

2 Upvotes

Hi,

A few days ago I was in the middle of doing some coursework for university and I ran into a problem with SQL developer. Last night something happened with oracle and it stopped working. I have tried uninstalling and reinstalling, deleting everything including what’s in the registry and it’s still not working. I have tried using the remote login to apps anywhere but I keep getting an error code (1033) when trying to connect to my database.  I stop all oracle services from running on services.msc then the error code 17002 happens. I have tried resetting my computer and have still been unsuccessful. I have gone through countless videos and websites and spent around 6 hours total trying to fix this.

I have removed all anti-virus, but I don't think it's an issue as when I originally downloaded SQL database it was not an issue then

All oracle DB services are running when checked on windows admin tools/services. I have also restarted them all

I have created a new firewall rule to allow traffic over the port that it was working originally with

I have checked tsnnames.ora and made sure it matches when creating the database. I have also made sure lsnrctl is running and it is. 

I have even gone to the extent of installing a new SSD and with new windows key and trying again but I am still having the same issues.

I am a university student and I have emailed my lecture about it and followed what he has advised me to do which has not worked. I am unsure of where to go I've been working since 9 this morning to try and fix the issue.


r/plsql • • Jun 21 '21

Exam 1Z0-149: Program with PL/SQL Certification

2 Upvotes

Hello,

I recently got certified with 1z0 071 and i figured out the next logical step into my career development will be getting the 1z0-149 certification aswell. I currently work as an System Analyst for a telco company and although I know that not every concept Oracle presents into the certification materials is usefull, I still want to get them as an personal objective.

My question to you is if, any of you got certified with 1z0-149 and if so, do you have any usefull materials which i can use? I am quite familiar with PL/SQL as i have wrote short functions and procedures part of my job tasks.

Thanks :D


r/plsql • • Jun 21 '21

Convert PLSQL code to flowchart - #PLSQL, #Javascript, #Python flowcharts - Code Profilers Other data visual solutions... - DataVisualizer - #Oracle Metadata - Bookmark Twitter Pay as you use, Sign-up with Google, Facebook or with email id to access all online solutions with 1/3/6 month subscription

Thumbnail
txsolve.com
2 Upvotes

r/plsql • • Jun 20 '21

plsql/data grip

2 Upvotes

hi guys i have a problem when i am running pl/sql scripts in datagrip i am getting task compiled but i cannot see the output how to get an output in datagrip

and when i am running dynamic block its not tacking input value in datagrip

declare

v1 emp.empno%type := '&empno';

v2 emp.ename%type;

begin

select empno,ename into v1,v2 from emp where empno = v1;

DBMS_OUTPUT.PUT_LINE(v1 || ' ' || v2);

end;

it shows this error

ORA-06502: PL/SQL: numeric or value error: character to number conversion error

any one has any solution..


r/plsql • • May 28 '21

Select Into Statement in Oracle PL/SQL

Thumbnail
javainhand.com
2 Upvotes

r/plsql • • May 25 '21

PL/SQL Deployment Script Generator

2 Upvotes

Hi,

I am in an Oracle development team where we develop large Oracle PL/SQL projects which are made up of dozens of files per release. The files are split into carefully standardized subfolders by type, E.G. /PACKAGES /FUNCTIONS /SYNONYMS /TABLES etc and all is stored in GIT.

I am trying to address a challenge which is the very large cost (time) to build the installation SQL file which invokes all of these separated out .SQL files. We are looking into creating a program that recursively scans through all the subfolders and creates a single installation file which refers (using @) to all of the subfolders. Has anyone done a project like this before, and have something you can share that I could base this off of?

I realize our folder structures won't be the same, but it would be nice if I can not start from scratch here. I know this program will not be PL/SQL based in itself.

Thanks


r/plsql • • May 11 '21

Need help with a procedure

2 Upvotes

Hi, I have this assignment from college, create a procedure .

It need to update one column of a PRODUCT table (its quantity)

create or replace PROCEDURE UPDATE_EXISTENCIAPRODUCTO (p_codproducto  NUMBER 
                                                        ,existencia  NUMBER)
AS 
BEGIN
    BEGIN
    IF NOT EXISTS (SELECT PRODUCTO FROM PRODUCTOS WHERE p_codproducto = producto) THEN
        DBMS_OUTPUT.PUT_LINE('No existe el codigo del producto seleccionado');
            RETURN;
        END IF;
        
    IF (existencia<0) THEN
        DBMS_OUTPUT.PUT_LINE('La existencia no puede ser menor a 0');
            RETURN;
        END IF;
    END;


UPDATE productos
set existencia_actual = existencia
where producto = p_codproducto;
  return;
  commit;
END UPDATE_EXISTENCIAPRODUCTO;

(existencia_actual is the column of how many products you have)

I'd like to know how if p_codproducto exists in the table Producto

I have trouble with Exception, dont know how to use it.


r/plsql • • Apr 20 '21

Help learning

2 Upvotes

Hi, anyone knows where can I learn PL/SQL from 0? Hopefully free.


r/plsql • • Apr 19 '21

Data Types in Oracle PL/SQL

Thumbnail
javainhand.com
2 Upvotes

r/plsql • • Apr 09 '21

Variables in Oracle PL/SQL-Part 2

Thumbnail
javainhand.com
2 Upvotes

r/plsql • • Apr 07 '21

Variables in Oracle PL/SQL - Part 1

Thumbnail
javainhand.com
2 Upvotes

r/plsql • • Mar 23 '21

Advantages of PL/SQL

2 Upvotes

Hello Group Members,

I have started to write articles on PL / SQL, here is my Second PL / SQL article please review and share your valuable feedback.

Advantages of PL/SQL

https://www.javainhand.com/2021/03/advantages-of-plsql-in-Oracle.html


r/plsql • • Oct 05 '20

Calculate Week Ending date in Oracle SQL where the week start is the previous SAT to the current FRI

2 Upvotes

I have a transaction date in my table that I would like to calculate a Week Ending date for

The problem is the weeks for us go from Saturday to Friday, don't ask me why,

So for example this week, today is 10/5/2020, the week end date should be 10/09/2020

and this Saturday, 10/10/2020, would be week ending date 10/16/2020.

Anyone know how to properly achieve this?


r/plsql • • Sep 21 '20

Copying Data from DB to DB

2 Upvotes

Hi,

Newbie here trying to learn Oracle and PLSQL. I'm currently trying to copy data from some tables in one database to the same tables in another database. The tables exist in both databases. I'm using a DB link via insert statements For example, I'm using a statement such as "insert into TABLE (select * from TABLE@OTHER_DB_LINK)". I'm having two issues.

  1. Some of the inserts are taking forever due to large amounts of data (millions of rows with constraints etc.). The problem could be number or records or maybe constraint checking?

  2. I'm having a hard time figuring out all the dependent table row data due to constraints on some of the columns. I only find out about the missing constraint relationship once that particular row is processed, which may be hours. I know how to see the defined constraints ahead of time but I can't pre-insert all the data into related tables as some values will already be there...it needs to be only the data related to the parent table records.

I'm wondering if there are any tips or methods that can help me?

  • I Googled a little bit and saw something about a DIRECT-Load insert? Would that help here?

  • Is there some magic statement I can run that will generate not only the SQL statements I need to populate a parent table but also the child tables that are dependent?

Thanks!


r/plsql • • Aug 21 '20

Problem with this query Ora-01427

2 Upvotes

Hello having problems with this query I tried everything. But i cannot seem to find where is the problem

SELECT P.NO_PERSONAL EXPEDIENTE, P.APELLIDO_PATERNO||' '||P.APELLIDO_MATERNO||' '||P.NOMBRE NOMBRE, CURP(P.NO_PERSONAL) CURP, P.RFC_ALFA||P.RFC_NUM||P.RFC_HOMO RFC, CG.RV_MEANING EDO_CIVIL, P.CALLE CALLE, P.NO_EXTERIOR NO_EXT, P.NO_INTERIOR NO_INT, P.COLONIA COLONIA, P.CODIGO_POSTAL CP, P.POBLACION LOCALIDAD, EF.NOMBRE ESTADO, (SELECT FP.DESCRIPCION FROM POSICIONES_ORGANIZACIONALES PO,SUBSUBFUNCIONES_PERSONAL FP WHERE PO.ESTATUS_PAGO <> 'I' AND PO.NO_FUNCION = FP.NO_FUNCION AND PO.NO_SUBFUNCION = FP.NO_SUBFUNCION AND PO.NO_SUBSUBFUNCION = FP.NO_SUBSUBFUNCION AND PO.NO_PERSONAL=P.NO_PERSONAL AND ROWNUM=1) FUNCIÓN, (SELECT NOMBRE FROM POSICIONES_ORGANIZACIONALES PO,PUESTOS PU WHERE PO.NO_PUESTO=PU.NO_PUESTO AND PO.NO_PERSONAL=P.NO_PERSONAL AND ESTATUS_PAGO='A' AND ROWNUM=1) PUESTO, (SELECT AF.DESCRIPCION FROM AREAS_FUNCIONALES AF, POSICIONES_ORGANIZACIONALES PO WHERE PO.CLAVE_AREA=AF.CLAVE_AREA AND PO.NO_PERSONAL=P.NO_PERSONAL AND ROWNUM=1) ADSCRIPCIÓN, (NVL((SELECT DESCRIPCION FROM RCA_JORNADAS WHERE CVE_JORNADA= (SELECT DISTINCT CVE_JORNADA FROM RCA_JORNADA_PLAZA J , POSICIONES_ORGANIZACIONALES PO1 WHERE PO1.ESTATUS_PAGO = 'A' AND PO1.NO_PERSONAL = P.NO_PERSONAL AND J.NO_POSICION = PO1.NO_POSICION AND ROWNUM = 1)),'SIN JORNADA')) JORNADA, (SELECT FECHA_INGRESO FROM POSICIONES_ORGANIZACIONALES WHERE ESTATUS_PAGO='A' AND ROWNUM=1 AND NO_PERSONAL=P.NO_PERSONAL) FECHA_INGRESO, P.IFE IFE,(SELECT ANIOS(SYSDATE,P.FECHA_NACIMIENTO) FROM DUAL) EDAD, /M_GENERAL.GN_TABULADOR(PO.NIVEL_SUELDO,PO.NO_PUESTO,DECODE(PO.NO_PARAMETRO,2,34,1),1,SYSDATE) * 2 SUELDO,/ (SELECT PDP.VALOR FROM PRESTACIONES_DEL_PERSONAL PDP WHERE PDP.NO_PERSONAL = P.NO_PERSONAL AND PDP.NO_PRESTACION = 22 AND PDP.ACTIVO = 'S') COMPENSACIÓN, (SELECT PDP.VALOR FROM PRESTACIONES_DEL_PERSONAL PDP WHERE PDP.NO_PERSONAL = P.NO_PERSONAL AND PDP.NO_PRESTACION = 23 AND PDP.ACTIVO = 'S') INGRESOS_PROPIOS, (SELECT PDP.VALOR FROM PRESTACIONES_DEL_PERSONAL PDP WHERE PDP.NO_PERSONAL = P.NO_PERSONAL AND PDP.NO_PRESTACION = 8 AND PDP.ACTIVO = 'S') TURNO_VESPERTINO, (SELECT PDP.VALOR FROM PRESTACIONES_DEL_PERSONAL PDP WHERE PDP.NO_PERSONAL = P.NO_PERSONAL AND PDP.NO_PRESTACION = 26 AND PDP.ACTIVO = 'S') ESTÍMULO FROM PERSONAL P, CG_REF_CODES CG, ENTIDADES_FEDERATIVAS EF WHERE P.ESTADO_CIVIL = CG.RV_LOW_VALUE AND CG.RV_DOMAIN = 'PERSONAL.ESTADO_CIVIL' AND P.NO_ENTIDAD = EF.NO_ENTIDAD AND P.ACTIVA_BAJA = 'A' ORDER BY 1


r/plsql • • Mar 28 '20

PL/SQL Mail Client API Examples | Get emails and attachment from a mail server

Thumbnail
foxinfotech.in
2 Upvotes

r/plsql • • Dec 04 '19

Pivot Table with an aggregate function

2 Upvotes

Novice PLSQL user here, so sorry if I use the wrong terminology!

I am trying to calculate averages for audits that are done several times a month throughout the year and put them in a pivot table to display. The audits are just questions that are answered yes/no/na, then the average is calculated by counting #yes/(#yes + #no) and that is the score. Here is what the normal report looks like with the averages:

I am new to pivot tables, and currently started by just counting the total number of question_answers each person has and displaying the number per month (currently it shows the total number of questions answered for the whole year for each month (72 answers total, and every month says 72) but this is fine since the pivot itself is how I want it. The pivot table now has the columns as the 12 months of the year, and the rows are the names of each employee:

Now what I would like to do is use this pivot table just like I have it, but I want the data to be the average audit scores. The score itself isn't saved to the database, as I just save the answers and calculate in Oracle APEX, and I keep running into issues when I try my query. This is the closest I got, but I think I'm mixing single-group functions and aggregate functions.

Any idea how to do this calculation within the pivot table code? The first photo shows how I calculate the score (it's the ugly nested CASE statements)

Thanks in advance!


r/plsql • • Nov 05 '19

Execute dbms_mview.refresh parallel

2 Upvotes

Hey, I'm currently trying to get my dbms_mview.refresh to be executed parallel, but so far with no avail. The Mviews are around 15-150 mil big. I already tried to insert an /+parallel()/ inside the Mview SQL statement (with the stars)
"... AS SELECT /+parallel(20)/ ..."
I tried
"alter materialized view Mview (degree 20);"
same as
"DBMS_MVIEW.REFRESH('Mview', 'C', PARALLELISM=>20);"
i also enabled
"ALTER SESSION ENABLE PARALLEL DML"
But only the "delete" funktion inside the dbms_mview.refresh is parallel not the "insert" part of the refresh.

I hope you can help me here.


r/plsql • • Nov 05 '19

Why don't the sections on Oracle appear anymore?

2 Upvotes

r/plsql • • Oct 10 '19

How do I make a variable of (2, 3, 5, 19, 22)

2 Upvotes

Here is a super simple example that I've seen:

select *
from persons
where person_id in (2, 3, 5, 19, 22);

Unfortunately, I have a script with a whole bunch of spots I need that exact where clause.

If I wanted to match against a single specific id on all those places, I could do something like the following:

declare
id integer := 5;
begin
select *
from persons
where person_id = id;
end;

But if I want to do the same thing with that list of numbers, which to me looks like an array construct in other languages, I don't know how to set up that variable in the declare.

So, is there a way for me to do something like the following?

declare
all_ids some_native_oracle_type := (2, 3, 5, 19, 22);
begin
select *
from persons
where person_id in all_ids;
end;

Maybe I'm just too new to pl/sql, but I can't even figure out what that data type would be, or even if it is a data type. Maybe it's a short hand for a select statement? I still need to figure out how to turn a select statement into a variable, too, but maybe that'll be another day. Thank you for your time.


r/plsql • • Sep 23 '19

Calling a function in a stored procedure?

2 Upvotes

How can I call a function within a stored procedure?

Say my function is "Delete_Cust"
And the procedure is "Delete_all_cust"

Thanks.


r/plsql • • Jun 24 '19

temporal tables like in sql server exist in PLSQL?

2 Upvotes

As the title says, I'm curious if there's a version for PLSQL. I just discovered of temporal tables exist in SQL server and seems to make it so much easier to maintain an audit table instead of writing triggers per table for PLSQL. Anybody know of an equivalent of such or does it not exist?


r/plsql • • Apr 23 '19

(Oracle) Performance Question: PL/SQL vs SQL for ETL with large case statements/complex rules

Thumbnail
self.oracle
2 Upvotes