plsql

How to call a procedure with a rowtype literal as parameter in PL/SQL?

落爺英雄遲暮 提交于 2021-01-27 16:29:23
问题 Lets say I have a table and a procedure that accepts one argument of the tables rowtype: CREATE TABLE t (a NUMBER, b NUMBER); CREATE PROCEDURE p (x t%ROWTYPE) IS BEGIN NULL; END; Can I call that procedure using a rowtype literal, that is without explicitly creating a rowtype variable (or at least not explicitly listing and assigning every field of it)? The two following approaches both generate the below error: p(1, 2); p((1, 2)); PLS-00306: wrong number or types of arguments in call to 'P'

Converting German special characters to English equivalent one in Oracle SQL / PL-SQL

淺唱寂寞╮ 提交于 2021-01-27 15:51:38
问题 I want to replace all German characters of a column of a table to corresponding English characters. When I tried with Replace() function it is not returning fruitful result. I want to replace all German special characters like- Ä Ö Ü ö ä ü ß to Ae Oe Ue oe ae ue ss. Please let me know how to perform that? Do I need to change any DB settings? Please find some results below: select replace('a b c d e ä f g ö','ä','ae') from dual; Output: REPLACE('ABCDEDFGV','D','AE') a b c ae e ae f g v I am

PL/SQL Trigger Issues

不羁的心 提交于 2021-01-27 13:33:15
问题 I am trying to write a trigger to populate a table containing information on an employee's updated salary. I'm having a problem that I can't quite wrap my head around at the moment. Here is the table to be populated: drop table SalUpdates cascade constraints; create table SalUpdates( SalSSN char(9), newSalary decimal(10,2), oldSalary decimal(10,2) ); This is my trigger: create or replace trigger t1 after update of salary on employee for each row begin insert into SalUpdates values (:old.Ssn,

Oracle PL/SQL Release 12.2.0.1.0 vs 12.1.0.2.0 - execute immediate with parameters

浪子不回头ぞ 提交于 2021-01-27 13:21:08
问题 DECLARE max_id INTEGER; BEGIN SELECT MAX(ID) + 1 INTO max_id FROM MY_TABLE; EXECUTE IMMEDIATE 'CREATE SEQUENCE MY_TABLE_ID MINVALUE 1 MAXVALUE 99999999999999 INCREMENT BY 1 START WITH ' || max_id || ' CACHE 100 NOORDER NOCYCLE NOPARTITION'; END; Above gives me ORA-00933: SQL command not properly ended when executed on Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production PL/SQL Release 12.2.0.1.0 - Production and works without errors on Oracle Database 12c Enterprise

PLS-00103: Encountered the symbol “;” when expecting one of the following:

邮差的信 提交于 2021-01-27 13:10:44
问题 I am trying to insert the answer to a user's security question, for use in the pin reset feature. Ellucian banner v8+ provides an API for running this and I very new to their API and from the looks of the error message below, I am far from running this correctly. Any help is appreciated. I tried running this in Oracle SQL Developer: execute gb_pin_answer.p_create( P_PIDM => 12345, P_NUM => 1, p_gobqstn_id => 1, p_qstn_desc => '', p_ansr_desc => 'David', p_ansr_salt => 'A123B456', p_user_id =>

Create a table based on a type

為{幸葍}努か 提交于 2021-01-27 07:09:41
问题 I have this following code snippet (SQL3) : Create Type person; Create Type child AS Table Of Ref person; Create Type person AS Object (name varchar(10), father ref person, children child); I want to understand what is the difference between the first and the second create type person. Also how can I create a table Employee based on the type person and insert data into it? 回答1: what is the difference between the first and the second create type person. Create Type person; The first is a

Create a table based on a type

回眸只為那壹抹淺笑 提交于 2021-01-27 07:07:35
问题 I have this following code snippet (SQL3) : Create Type person; Create Type child AS Table Of Ref person; Create Type person AS Object (name varchar(10), father ref person, children child); I want to understand what is the difference between the first and the second create type person. Also how can I create a table Employee based on the type person and insert data into it? 回答1: what is the difference between the first and the second create type person. Create Type person; The first is a

Get table return value from PL/SQL stored function using JDBC

喜你入骨 提交于 2021-01-27 06:30:53
问题 I have a PL/SQL stored function which returns a table of integers: CREATE TYPE INT_TABLE IS TABLE OF INTEGER; CREATE FUNCTION f (someParam IN INTEGER) RETURN INT_TABLE IS ... I wish to use JDBC to retrieve the result of this function so that I can iterate through the integers in some way, be it a ResultSet , int[] , or whatever. The function f performs modifications to the database, so it cannot be called in a query such as SELECT f(42) FROM DUAL; . The return value exists to inform the

Oracle: What does 'execute immediate' mean?

爱⌒轻易说出口 提交于 2021-01-27 05:07:24
问题 What is the significance of execute immediate in PL/SQL when used with DML and DDL statements? Does execute immediate implicitly commit to a database like DDL statements do ? The following is an example I have encountered: SELECT 'TRUNCATE TABLE BD_BIDS_APPR_DET' INTO V_SQL1 FROM DUAL; EXECUTE IMMEDIATE V_SQL1; SELECT 'TRUNCATE TABLE BD_BIDS_SYS_DET' INTO V_SQL1 FROM DUAL; EXECUTE IMMEDIATE V_SQL1; SELECT 'TRUNCATE TABLE BD_BIDS_EXT_DET' INTO V_SQL1 FROM DUAL; EXECUTE IMMEDIATE V_SQL1; 回答1:

Abort a PL/SQL program

ⅰ亾dé卋堺 提交于 2021-01-21 12:03:42
问题 How do I get a PL/SQL program to end halfway through? I haven't been able to find any way to gracefully end the program if an exception occurs - if I handle it, it loops back into the code. Basically what I want to do is force the app not to run in certain conditions. So, I want to add something like this to the top of the program: BEGIN IF [condition] EXIT END IF [the rest of the program] END The suggested way is to throw an exception, but the block may well be an inner block - so the