Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Make your voice heard. Take the 2019 Developer Survey now

Questions tagged [plsql]

Procedural Language/Structured Query Language is Oracle Corporation's procedural language extension for SQL. IBM supports PL/SQL for DB2 since version 9.7. Questions about PL/SQL should probably be tagged "oracle" or "db2" as well.

0
votes
1answer
18 views

Store Function Value into temporary table

Hi i'm currently trying to run a SQL query on a 15 000 + entry dataset. I'm using a custom Mysql function to determine the start of the current week and the end of it. Probleme is, I'm using those ...
0
votes
1answer
35 views

Syntax error in PL SQL [closed]

i'm trying to do a command that gather stats of tables that has more than 10 million rows. Right now only one table has, but i want the command to execute the gathering to more tables as soon as they ...
0
votes
1answer
29 views

Oracle schema object name when fire trigger

I need to get the object name and user name from oracle schema after fire a trigger. It executes on DDL statements. I need to get executed user name and object name which trigger executed on. Below is ...
0
votes
1answer
32 views

What slows down this histogram query?

I have a table my_link_t with columns t.weight type number and categorical speedcat type integer values from 2 to 8. I want to split data in buckets from min=0, max=0.6, step = 0.001 and build a 3D ...
1
vote
1answer
32 views

Is there any other way to replace cursor for the following scenario

Table IA Id Status Details 1 open aaa 2 close bbb 3 open ccc 4 open ddd 5 open eeee 6 open ffff 7 open gggg 8 close iii 9 close hhh 10 ...
0
votes
1answer
32 views

Extract values from oracle pl sql cursor

I have a function that returns a cursor. When I execute select t.id, t.f_rc(id) from my_table t I get id F_RC(TID) 1 < cursor > 2 < cursor > 3 < cursor > ... How to expand ...
0
votes
1answer
38 views

Custom return type of a function in Oracle PL SQl

I have a query and I want to wrap it into a function. Currently query returns in_count, in_sum, out_count, out_sum. I only know how to return a "primitive type". So currently I have four different ...
0
votes
1answer
48 views

How to make a function from a concrete SELECT statement in Oracle SQL?

How to replace a concrete value with a variable in Oracle SQL? I have select 5, min(id) from my_table where id > 5 --AND ... complex condition UNION ALL select 6, min(id) from my_table ...
1
vote
0answers
41 views

Count neighbors and sum of the neighbors values

I am looking at an edge and adjacent edges. Edge priority decreases with (1) Decrease of edge weight (2) Increase of the number of neighboring edges (3) Increase in total weight of shortest distinct ...
0
votes
1answer
56 views

Updating Database table from another machine

I am trying to update my database using a batch file. Batch file is located on machine say ABC which should pick a text file from the local directory on ABC and upload that file to DATABASE located on ...
1
vote
3answers
46 views

PL/SQL date or to_char question

begin if TO_CHAR('23-OCT-1994','DAY') = 'FRIDAY' THEN DBMS_OUTPUT.PUT_LINE('FRIDAY'); else DBMS_OUTPUT.PUT_LINE('Not Friday'); end if; end; / I am trying to ...
1
vote
2answers
28 views

Difficulty Understanding Oracle DQL Procedures and Functions Coming from T-SQL

I am much more familiar with SQL Server, but I am doing a project now in Oracle. There is a concept from SQL Server that I am not sure how to accomplish in Oracle. In SQL Server if I create a ...
0
votes
1answer
119 views

Select unique records from multiple records based on max date

I have table like below +----+----------+-----+-------------+--------+ | ID | ADDR | IND | update_Date | Sq_NBR | +----+----------+-----+-------------+--------+ | 1 | PHYSICAL | Y | 11-Oct ...
0
votes
1answer
266 views

is it possible to use utl_file_dir = '*' scope = spfile in 12c

Oracle 12c has deprecated utl_file_dir = '*' scope = spfile, but I need to use this functionality. Is there any option to do it? Is it possible to give permission using Java classes?
0
votes
1answer
23 views

Variable Assignment and Usage in Oracle

Why does this fail in SQL Developer against an Oracle database and what would the an appropriate way of achieving the same? DECLARE v_pNbr NUMBER := 100150; begin select * from TARGETTABLE ...
1
vote
2answers
50 views

PL/SQL - Member Function: Link directly to object without parameters

I want a table generated from a table function in oracle. Like this: +--------------------------------------------------------------------+ | CUSTOMERS ...
0
votes
2answers
55 views

read/write/execute to pl/sql grants [closed]

For a current task and future references, I am wondering how pl/sql grants (select, insert, update, delete, references, alter, index, all) are categorized from a read/write/execute or read/read-write/...
0
votes
1answer
221 views

oracle sql: How to not select select duplicate records from table

Can any help me to fix the below sql query SELECT DISTINCT ORDER_NUMBER, FLAG FROM TABLE Below was the result Order_number FLAG LP-13288 false LP-13288 true LP-13292 false LP-13290 ...
2
votes
0answers
233 views

Changing a JSON object parsed with APEX_JSON

I would like to be able to change a JSON object parsed with the APEX_JSON.parse() function, but I found nothing in the official documentation, no tips or examples about that. In the code below I ...
0
votes
2answers
761 views

Update row with multiple row in another table Error : ORA-01427: single-row subquery returns more than one row? [closed]

I have Table A with 1 row and wanted to update it from another table (which has 3 rows for it and I can take any one of them). Table A ----------- TrnID | trn_Status 2345 | null 9876 | null 9878 | ...
2
votes
0answers
1k views

ORA-01031: insufficient privileges solution oracle

Create or replace procedure myprocedure is stmt varchar2(1000); stmt2 varchar2(1000); begin stmt := 'create global temporary table temp(id number(10))'; execute immediate stmt; ...
2
votes
2answers
205 views

Execute sql file in Exception statement

Hi I'm trying to execute an SQL File in a Exception Statement when I'm executing an Spool file. I have something like this: column dt new_value _dt select to_char(sysdate,'yyyymmdd_hh24mi') dt from ...
0
votes
2answers
53 views

Retrieve date column default values from BINARYDEFVAL column in sys.ecol$

I am trying to retrieve BLOB values in BINARYDEFVAL column from sys.col$ table. The BINARYDEFVAL of sys.ecol$ table stores default column values in BLOB format. For VARCHAR2 and NUMBER I am able to ...
0
votes
0answers
23 views

Grant in advance privileges on Schema A for dynamically created tables on Schema B in oracle

I have the following scenario in my Oracle Database (11g) and I am trying to work around grants and access privileges. Note that the following is just a Minimum Viable Example and it does not cover ...
1
vote
1answer
33 views

PL/SQL Loop Returning One Result

I'm working with the following script: create or replace PROCEDURE a_proc is vi_get_emails varchar2(500); cursor get_emails is SELECT DISTINCT purchase_authorizer_api.get_userid('30', pagl....
1
vote
2answers
52 views

I'm going to wrap database trigger's source code, command properly run but source not encrypt

I'm going to wrap my source of database logon trigger. i run the command, "wrap iname='E:\block_tools_trigger_HR.sql' oname='E:\block_tools_trigger_HR.plb'". plb file created without any error but ...
0
votes
1answer
101 views

How do I execute a PL/SQL package from my database SQL> prompt?

Sorry to ask such a basic question, but I am yet to do my Oracle course at work and I am already required to do some run PL/SQL processes. I have installed a 'package' using SQL Developer, see it ...
0
votes
1answer
22 views

Oracle 11g - PL/SQL block - Unable to use a newly added column in subsequent DML

begin execute immedate 'alter table my_table add new_column varchar2(30)'; update my_table set new_column=old_column; end; Here the update statement fails stating that the new_column is not ...
0
votes
1answer
364 views

how do you output a plsql array via ref cursor

I have a legacy procedure that returns a plsql assoc table to a C++ DLL. Now I need to call it via C# and ODP.NET. I have been unable to find any info on how to call a proc that returns a pl/sql ...
2
votes
2answers
192 views

Deploy materialized view with database link using another user

Our database deployment process logs in as sys to deploy database objects. We ran into a problem when we wanted to deploy a private database link for another user (AU). Our solution was to: Create ...
0
votes
1answer
295 views

create a backup table with million records

I want to move old records from TABLEA to TABLEA_AUDIT. TABLEA have around 1.5 million records and it have two nested tables. No of Records : 1557951 Size : 1024 MB I tried it by, 1.using ...
2
votes
1answer
40 views

User defined function can only have select statements

One of the main differences between UDF and SP is that UDF can only have select statements inside it and not insert/update/delete statements. Can someone please explain the reason behind this? The ...
0
votes
3answers
502 views

creating trigger which will insert into table from view

I have view LIVE_MATCHES (home,away,comp_name) and table MATCHES (priority ,sport,sub_list) I need to create a trigger that inserts in TABLE from VIEW after the view is updated or inserted (doesn't ...
4
votes
2answers
55 views

Add column for subsequent values for a record

I have a table structured as follows: CREATE TABLE t ( HHID varchar2(1), INDIV_ID int, PRIM varchar2(1) ); insert into t values ('A', 10, 'Y'); insert into t values ('A',...
0
votes
1answer
208 views

Set columns dinamically in UTL_FILE

I've been stuck with this problem, so I'm looking for help now. I'm trying to get a .cvs file from a query with PL/SQL. I'm using a cursor and UTL_FILE to achieve that. The problem is that I have to ...
0
votes
0answers
30 views

ORA-6502 not being caught by Oracle DML Error logging

I have added DML Error Logging while inserting records into a table. INSERT INTO <table_name> SELECT column_name ... FROM TABLE(function_name()) LOG ERRORS INTO <...
0
votes
0answers
29 views

Trouble shooting ORA-29471

Certain sessions cause ORA-29471 because dbms_sql inoperable for those sessions. We are facing this error in our application for few records. How this can be troubleshooted? How we can identify a ...
1
vote
1answer
179 views

Oracle Tracing Activity of Triggers

Our legacy application has over 4000+ triggers. In order to diagnose a bug, we have to trace which trigger(s) inserted records into a particular table. Had the legacy triggers logged their activity ...
1
vote
3answers
92 views

Trigger INSERTING into a row

I am trying to create a Trigger that will fire when a new student is being added to the table. It should update the a table called: MAJOR, by incrementing its MCOUNT domain by one. CREATE TABLE ...
0
votes
1answer
51 views

Restriction trigger to users

I'm trying to create a logon trigger that will restrict users views so that one user can select/ view jobs relating to them and only to them within the JOB table. Additionally these new users must ...
0
votes
1answer
259 views

Oracle procedure with input parameter that performs multiple SUBSTR

I have a table Employee with the columns employee_id as type number, and employee_name as type varchar. I need a procedure that takes an input string to insert employees into the table. The ...
1
vote
0answers
164 views

How can I count affected rows by an insert and a merge statement

I have little experience with DB2. I have been trying to find out how to get the number of affected rows (after insert and merge statements) and/or a success message to give back to my HTTP Post ...
1
vote
0answers
80 views

Alternatives to using subqueries as parameters?

I have a very large non-partitioned table that is taking a long time to return results from this query: SELECT (SELECT Listagg(VALUE_STRING, ', ') WITHIN GROUP (ORDER BY ...
0
votes
1answer
376 views

Variable values in Oracle where clause [closed]

I am trying to pass an variable value in my Select statement where clause, I tried a very simple query like below Declare v_WK varchar(20); exec :v_WK :='Wk 6' Select * from myTable Where Column = :...
0
votes
1answer
64 views

How to Create Table Name That Contains Last Month in Suffix

I want to create a table with the last month's name as part of the table name. If the current month is February then I would want the table name to look like this: table_name_jan18 The statement I ...
0
votes
0answers
28 views

How can I implement row-level accessing control in oracle?

I want to configure an access control that each member of staff should be able to see their own personal details and grant alter privilege to each user to modify their own information for some columns....
0
votes
1answer
830 views

ORA-03135 connection lost contact

First i connect to oracle remotely, then open pl/sqldeveloper create one table. Then i am trying to import csv file to PL/sql developer. Importing process starts normally, but every day midnight we ...
1
vote
1answer
52 views

Spliting name with delimiter

Hi can you help me to split the name into firstname, middle name, lastname using a pl/sql procedure. This my procedure: create or replace procedure proc_name(name in varchar2, a out varchar2, b out ...
1
vote
1answer
84 views

How to find object name given in a problematic query [closed]

I want to know the name of database object which is running the part of my query which is causing problem From the awr report, I found one query which is making some performance issue, but I am not ...
0
votes
2answers
52 views

How to make tables unavailable for users during certain times in Oracle?

Iam a student and one of the questions i am stuck is to implement an IT management rule on all tables in oracle in my own schema using pl/sql.I dont have DBA previlege and the requirement is that on ...