CREATE TABLE Docente
(
opcion varchar2(10),
id_Docente NUMBER,
nombre VARCHAR2(30),
apellido VARCHAR2(30),
cedula NUMBER,
titulo VARCHAR2(100),
observaciones VARCHAR2(200),
estado VARCHAR2(10),
mensaje varchar2(50) NULL,
CONSTRAINT PK_Docente PRIMARY KEY (id_Docente)
);
CREATE OR REPLACE PROCEDURE sp_crud_docente(
p_opcion varchar2,
p_id_Docente NUMBER,
p_nombre VARCHAR2,
p_apellido VARCHAR2,
p_cedula NUMBER,
p_titulo VARCHAR2,
p_observaciones VARCHAR2,
p_estado VARCHAR2,
p_mensaje out varchar2)
as
v_valor int;
v_row Docente%rowtype;
begin
if (p_opcion = 'I') then
begin
Select MAX(id_Docente)+ 1 into v_valor from Docente;
if v_valor is null then
v_valor := 1;
p_mensaje:= 'Registro inserted...';
DBMS_OUTPUT.PUT_LINE(p_mensaje);
insert into Docente
values (p_opcion,v_valor,p_id_Docente,p_nombre,p_apellido,p_cedula,p_titulo,p_observaciones,p_estado);
end if;
end;
else if (p_opcion = 'U') then
update Docente set opcion=p_opcion,
id_Docente=p_id_Docente,
nombre=p_nombre,
apellido=p_apellido,
cedula=p_cedula,
titulo=p_titulo,
observaciones=p_observaciones,
estado=p_estado
where id_Docente=p_id_Docente;
p_mensaje:= 'Registro updated...';
DBMS_OUTPUT.PUT_LINE(p_mensaje);
else if (p_opcion = 'S') then
begin
Select
opcion,
id_Docente,
nombre,
apellido,
cedula,
titulo,
observaciones,
estado,
mensaje
into v_row
from Docente;
p_mensaje := ('Ok');
DBMS_OUTPUT.PUT_LINE(p_mensaje||' --> '||v_row.opcion||'|'||v_row.id_Docente||'|'||v_row.nombre||'|'||v_row.apellido||'|'||v_row.cedula||'|'||v_row.titulo||'|'||v_row.observaciones||'|'||v_row.estado||'|'||v_row.mensaje);
end;
else if (p_opcion = 'D') then
Delete from Docente where id_Docente=p_id_Docente;
p_mensaje := ('Proceso ejecutado correctamente');
DBMS_OUTPUT.PUT_LINE(p_mensaje);
commit;
end if;
end if;
end if;
end if;
EXCEPTION
WHEN OTHERS then
p_mensaje := ('ERROR. No se pudo ejecutar el proceso');
rollback;
end;
Take out the length of the incoming parameters:
create or replace procedure sp_crud_docente (
p_opcion varchar2,
p_id_Docente NUMBER,
p_nombre VARCHAR2,
p_apellido VARCHAR2,
p_cedula NUMBER,
p_titulo VARCHAR2,
p_observaciones VARCHAR2,
p_estado VARCHAR2,
p_mensaje out varchar2)
See 8.7.1 Formal and Actual Subprogram Parameters section of the 19c manual "Database PL/SQL Language Reference"
Bobby
Apart from the fact that varchar2 parameters can't have size, this is practically unsolvable without you posting the docente table description.
Bad habits kick; you're wrongly relying on the fact that you know what you're doing, but it turns out you don't.
I can't figure out how many nor which columns docente contains, and in which order.
insert into docente should explicitly mention all columns you're inserting into, one-by-one. Code you wrote suggests that table contains 9 columns (opcion, id_docente, nombre, apellido, cedula, titulo, observaciones, estado).
update, on the other hand, updates only 6 of them (nombre, apellido, cedula, tutlo, observaciones, estado) which doesn't collide with insert; it is OK if you don't update all columns.
However, p_opcion = 'S' selects only 7 columns into v_row which is declared as docente%rowtype. Out of those 7 columns, I believe you "forgot" a comma between id_docente and nombre - those are two columns, it's not that nombre is id_docente's alias, right? Suppose it is 8 columns that are selected after all. Now, that collides with number of columns you used in insert (9 of them). If you're selecting into %rowtype, you must select ALL columns in EXACT ORDER.
I suggest you review code you wrote, pay attention about what I said and fix those errors.
Related
I am trying to use dynamic SQL to insert values into my table. But I am struggling with it! This is my table
CREATE TABLE CARS
(
ID INTEGER PRIMARY KEY,
Manufacturer VARCHAR2(1000),
Model VARCHAR2(1000),
Year INTEGER NOT NULL,
Category VARCHAR2(1000) NOT NULL,
Mileage NUMBER,
FuelType VARCHAR2(1000),
EngineVolume NUMBER,
DriveWheels VARCHAR2(1000),
GearBox VARCHAR2(1000),
Doors VARCHAR2(1000),
Wheel VARCHAR2(1000),
Color VARCHAR2(1000),
InteriorColor VARCHAR2(1000),
VIN VARCHAR2(1000),
LeatherInterior VARCHAR2(1000) NOT NULL,
Price VARCHAR2(1000) NOT NULL,
Clearence VARCHAR2(1000) NOT NULL
)
And I have created a trigger that will increment the id column automatically.
CREATE SEQUENCE cars_seq START WITH 93100;
CREATE OR REPLACE TRIGGER cars_id_inc
BEFORE INSERT ON cars FOR EACH ROW
BEGIN
:NEW.ID := CARS_SEQ.nextval;
END;
Then I have created a procedure that will insert values into the cars table.
CREATE OR REPLACE PROCEDURE insert_all_cars (p_values VARCHAR2) IS
v_stmt VARCHAR2(10000);
BEGIN
v_stmt := 'INSERT INTO CARS ' || ' VALUES ' || p_values;
EXECUTE IMMEDIATE v_stmt;
END;
When I am trying to insert values to the cars table using a procedure like this:
DECLARE
p_values VARCHAR2 := '(''new_manufacturer'', ''new_model'', ' || '2000' || ' ,''new_category'', ' || '2000' ||' ,''new_fueltype'', ' || '3.0' ||
' ,''new_drivewheels'',''new_gearbox'',''new_doors'',''new_wheel'',''new_color'',
''new_interior_color'',''new_vin'',''new_leather_interior'',''new_price'',''new_clearence'')';
BEGIN
insert_all_cars(p_values);
END;
I am getting this kind of error:
Error starting at line : 60 in command -
DECLARE
p_values VARCHAR2 := '(''new_manufacturer'', ''new_model'', ' || '2000' || ' ,''new_category'', ' || '2000' ||' ,''new_fueltype'', ' || '3.0' ||
' ,''new_drivewheels'',''new_gearbox'',''new_doors'',''new_wheel'',''new_color'',
''new_interior_color'',''new_vin'',''new_leather_interior'',''new_price'',''new_clearence'')';
BEGIN
insert_all_cars(p_values);
END;
Error report -
ORA-06550: line 2, column 14:
PLS-00215: String length constraints must be in range (1 .. 32767)
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
Also tried to put numbers without quotes got the same kind error.
How I can fix it?
You didn't define the length of p_values in your anonymous pl/sql block. But why use dynamic sql? This is a really poor use case for it. Why not this?
create or replace procedure insert_all_cars (
p_manufacturer VARCHAR2,
p_model VARCHAR2,
p_year INTEGER,
p_category VARCHAR2,
p_mileage NUMBER,
p_fueltype VARCHAR2,
p_enginevolume NUMBER,
p_drivewheels VARCHAR2,
p_gearbox VARCHAR2,
p_doors VARCHAR2,
p_wheel VARCHAR2,
p_color VARCHAR2,
p_interiorcolor VARCHAR2,
p_vin VARCHAR2,
p_leatherinterior VARCHAR2,
p_price VARCHAR2,
p_clearence VARCHAR2) is
begin
insert into cars (
Manufacturer,
Model,
Year,
Category,
Mileage,
FuelType,
EngineVolume,
DriveWheels,
GearBox,
Doors,
Wheel,
Color,
InteriorColor,
VIN,
LeatherInterior,
Price,
Clearence )
values (
p_manufacturer,
p_model,
p_year,
p_category,
p_mileage,
p_fueltype,
p_enginevolume,
p_drivewheels,
p_gearbox,
p_doors,
p_wheel,
p_color,
p_interiorcolor,
p_vin,
p_leatherinterior,
p_price,
p_clearence );
end;
/
And then this:
begin
insert_all_cars (
p_manufacturer => 'new_manufacturer',
p_model => 'new_model',
p_year => 2000,
p_category => 'new_category',
p_mileage => 2000,
p_fueltype => 'new_fueltype',
p_enginevolume => 3.0,
p_drivewheels => 'new_drivewheels',
p_gearbox => 'new_gearbox',
p_doors => 'new_doors',
p_wheel => 'new_wheel',
p_color => 'new_color',
p_interiorcolor => 'new_interior_color',
p_vin => 'new_vin',
p_leatherinterior => 'new_leather_interior',
p_price => 'new_price',
p_clearence => 'new_clearence'
);
commit;
end;
/
Stored procedure is not returning the value that I am expecting. I did not know what is the problem with the procedure.
Here is the procedure:
CREATE OR REPLACE procedure PRC_CUSTOMER_WITH_LOGIN
(p_name_out out varchar2,
p_count out int,
p_all_records out SYS_REFCURSOR,
p_mode in varchar2,
p_id in varchar2,
p_name_in in varchar2,
p_contact_no in varchar2,
p_email in varchar2,
p_address in varchar2)
IS
BEGIN
IF p_mode='q'
THEN
select NAME into p_name_out from customer where id='1';
ELSIF p_mode='i'
THEN
INSERT into customer(id,name,contactNo,email,address)
Values(p_id, p_name_in, p_contact_no , p_email , p_address);
ELSIF p_mode='u'
THEN
UPDATE customer set name=p_name_in, contactNo=p_contact_no, email=p_email, address=p_address
where id=p_id;
ELSIF p_mode='d'
THEN
DELETE from customer where id=p_id;
ELSIF p_mode='a'
THEN
OPEN p_all_records FOR
select * from customer;
ELSIF p_mode='l'
THEN
SELECT COUNT(*) into p_count from customer WHERE name=p_name_in AND id=p_id;
END IF;
END;
/
This is the procedure all other conditions are working fine but the last condition is not working correctly this condition return 0 all the time whether I enter the correct id and name or wrong.
Here I am calling this procedure
cs = (OracleCallableStatement) con.prepareCall("{call TESTDB.PRC_CUSTOMER_WITH_LOGIN(?,?,?,?,?,?,null,null,null)}");
cs.registerOutParameter(1, OracleTypes.VARCHAR);
cs.registerOutParameter(2, OracleTypes.INTEGER);
cs.registerOutParameter(3, OracleTypes.CURSOR);
cs.setString(4, "l");
cs.setString(5, password);
cs.setString(6, name);
cs.executeQuery();
chk=cs.getInt(2);
System.out.println(chk);
Can someone tell me what the mistake is that I'm making here? I shall be thankful .... :)
Try to use UPPER both side so if any case sensitive names are there then it will nullify it.
SELECT COUNT(*) into p_count from customer WHERE upper(name)=upper(p_name_in) AND id=p_id;
Maybe you are wrong when you set id with the password value?
1-> p_name_out out varchar2,
2-> p_count out int,
3-> p_all_records out SYS_REFCURSOR,
4-> p_mode in varchar2,
5-> p_id in varchar2, --- 5 is id, not password ??!?
6-> p_name_in in varchar2,
p_contact_no in varchar2,
p_email in varchar2,
p_address in varchar2
cs = (OracleCallableStatement) con.prepareCall(
"{call TESTDB.PRC_CUSTOMER_WITH_LOGIN(?,?,?,?,?,?,null,null,null)}");
cs.registerOutParameter(1, OracleTypes.VARCHAR);
cs.registerOutParameter(2, OracleTypes.INTEGER);
cs.registerOutParameter(3, OracleTypes.CURSOR);
cs.setString(4, "l");
cs.setString(5, password);
cs.setString(6, name);
Another possibility is your id/password is stored as encrypted thing?
I'm trying to insert multiple value into a particular table by return select query I'm not able to insert into table.If I'm doing wrong somewhere please let me know.Thanks in advance.
create or replace PROCEDURE DE_DUP_PROC1 (Dy_File_Name IN VARCHAR2,
SUPPLIER_CD IN VARCHAR2,
EXT_PHARMA_ID IN VARCHAR2,
FLAG_VALUE IN VARCHAR2,
ERR_COUNT IN VARCHAR2,
OUTPUT_STATUS OUT NUMBER)
AS
c2 SYS_REFCURSOR;
De_Dub_rec1 VARCHAR2 (2000);
v_sql VARCHAR2 (2000);
v_sql1 VARCHAR2 (2000);
ORGNIZATION_ID NUMBER(20);
PHARMACY_ID NUMBER(38);
v_dup_count VARCHAR2 (2000);
SRC_ID NUMBER(38);
DE_DUP_COUNT NUMBER(38);
DE_REC_COUNT1 NUMBER(10) := 3;
TYPE rec_typ IS RECORD
(
OLD_TRANS_GUID VARCHAR2 (255),
R_DSPNSD_DT DATE,
DETL_CLMNS_HASH1 VARCHAR2(255),
KEY_CLMNS_HASH1 VARCHAR2(255),
SUPPLIER_PHARMACY_CD1 VARCHAR2(200)
);
De_Dub_rec rec_typ;
BEGIN
IF DE_REC_COUNT1 > 0
THEN
OUTPUT_STATUS := 0;
dbms_output.put_line(OUTPUT_STATUS);
ELSE
SRC_ID := SRC_FILE_ID_SEQ.nextval
OPEN c2 FOR
( ' SELECT S.TRANS_GUID AS OLD_TRANS_GUID,S.DETL_CLMNS_HASH AS DETL_CLMNS_HASH1 ,S.KEY_CLMNS_HASH AS KEY_CLMNS_HASH1,S.RX_DSPNSD_DT AS R_DSPNSD_DT,
S.SUPPLIER_PHARMACY_CD AS SUPPLIER_PHARMACY_CD1 FROM (SELECT stg.*, row_number() over (partition BY key_clmns_hash ORDER BY 1) AS RN FROM
' || Dy_File_Name || ' stg ) s JOIN ps_pharmacy p ON s.extrnl_pharmacy_id = p.extrnl_pharmacy_id LEFT JOIN ps_rx_hist H
ON h.key_clmns_hash = s.key_clmnS_hash
AND h.rx_dspnsd_dt = s.rx_dspnsd_dt
AND s.supplier_pharmacy_cd = h.SUPPLIER_PHARMACY_CD
WHERE S.RN > 1
OR s.detl_clmns_hash = h.detl_clmns_hash ' );
LOOP
FETCH c2 INTO De_Dub_rec;
EXIT WHEN c2%NOTFOUND;
insert into PS_RX_DUPES(TRANS_GUID,DETL_CLMNS_HASH,KEY_CLMNS_HASH,RX_DSPNSD_DT,SUPPLIER_PHARMACY_CD,SRC_FILE_ID)
values(De_Dub_rec.OLD_TRANS_GUID,De_Dub_rec.DETL_CLMNS_HASH1,De_Dub_rec.KEY_CLMNS_HASH1,De_Dub_rec.R_DSPNSD_DT,De_Dub_rec.SUPPLIER_PHARMACY_CD1,SRC_ID);
commit;
END LOOP;
OUTPUT_STATUS := 1;
dbms_output.put_line(OUTPUT_STATUS);
END IF;
END DE_DUP_PROC1;
Whenever I'm executing above stored procedure I below error
declare
OUTPUT_STATUS number(2);
begin
DE_DUP_PROC1('T_MCL_10622_20150317_01526556','MCL','10622','BD','3',OUTPUT_STATUS);
end;
Error at line 1
- ORA-01007: variable not in select list
ORA-06512: at "PS_ADMIN.DE_DUP_PROC1", line 53
ORA-06512: at line 6
Oracle hurls ORA-01007 when the columns of our query don't match the target variable.
Line 53 is this line FETCH c2 INTO De_Dub_rec;, so the clue is the projection of the cursor doesn't match the record type.
Your free-text SELECT statement is messily laid out, which makes debugging hard. Let's tidy up the projection:
SELECT S.TRANS_GUID AS OLD_TRANS_GUID
, S.DETL_CLMNS_HASH AS DETL_CLMNS_HASH1
, S.KEY_CLMNS_HASH AS KEY_CLMNS_HASH1
, S.RX_DSPNSD_DT AS R_DSPNSD_DT
, S.SUPPLIER_PHARMACY_CD AS SUPPLIER_PHARMACY_CD1
FROM ...
Now it becomes easy to see that the column order is different from the type's attribute order:
TYPE rec_typ IS RECORD
(
OLD_TRANS_GUID VARCHAR2 (255),
R_DSPNSD_DT DATE,
DETL_CLMNS_HASH1 VARCHAR2(255),
KEY_CLMNS_HASH1 VARCHAR2(255),
SUPPLIER_PHARMACY_CD1 VARCHAR2(200)
);
So your code is trying to put a string into a date variable (and vice versa, but at least Oracle can cast that).
All of which goes to prove that clear layout is not a silly OCD thing. Discipline in writing code helps us write better code quicker by highlighting obvious errors.
I think that I would tackle this problem by having a synonym that is dedicated to this process, and which you redefine to point at the appropriate source table prior to selecting from it. Then you can use regular SQL, which will be much more simple.
Alternatively, instead of constructing this cursor you can define an appropriate insert statement dynamically and use execute immediate to run it.
The cursor approach is more complicated, slower, and (as you have seen) more liable to have coding errors.
CREATE or REPLACE PROCEDURE SP_INSERT_OVERSEAS_COMPANY
(
COMPANY_CODE IN NUMBER,
COMPANY_NAME IN VARCHAR2,
STREET_ADDR IN VARCHAR2,
COMPANY_STATE IN VARCHAR2,
ZIP_CODE IN VARCHAR2,
COUNTRY IN VARCHAR2,
CONTACT_PERSON IN VARCHAR2,
CONTACT_NUMBER IN VARCHAR2
)
AS
BEGIN
IF sysdate between trunc(sysdate,'DD')+interval '9' hour and trunc(sysdate,'DD')+interval '17' hour
THEN
INSERT INTO Overseas_Company
VALUES
(COMPANY_NAME,COMPANY_NAME,STREET_ADDR,COMPANY_STATE,ZIP_CODE,COUNTRY,CONTACT_PERSON,CONTACT_NUMBER);
ELSE
dbms_output.put_line ('Process is outside of normally working hours');
END IF;
END SP_INSERT_OVERSEAS_COMPANY;
/
Should COMPANY_NAME,COMPANY_NAME,... be COMPANY_CODE,COMPANY_NAME,...? The parameter COMPANY_CODE is not used in the procedure. Are you getting numeric conversion errors?
I have a task that involves updating many triggers which are exactly the same query but applied to several different tables. Is there a way to update all these TRIGGERS using a FOR or similar statement? Actually what I need to do is modify the WHEN clause for all this triggers.
you can use dbms_metadat for this.
for example:
declare
type arr_tab is table of varchar2(30);
v_arr arr_tab;
v_trig clob;
begin
dbms_metadata.set_transform_param( DBMS_METADATA.SESSION_TRANSFORM,
'SQLTERMINATOR', FALSE );
v_arr := arr_tab('TEST_TRIG', 'TEST2_TRIG'); -- change these triggers.
for idx in 1..v_arr.count
loop
v_trig := dbms_metadata.get_ddl('TRIGGER',v_arr(idx), user);
execute immediate regexp_replace(regexp_replace(v_trig, 'ALTER TRIGGER.*', ''), 'WHEN ([^\)]*\))', 'WHEN (1=1)', 1, 1, 'mi');
end loop;
end;
/
the 'WHEN ([^\)]*\))', 'WHEN (1=1)' part replaces the WHEN clause with (in my case) WHEN (1=1).
You can use dba_triggers to extract the text of the trigger into CREATE or replace statements. But due to some of the columns being LONG datatype you will have trouble extracting them as VARCHAR2. This can be resolved by using Tom Kytes package which is lost somewhere on the oracle site. I include my own version which you may have to modify to meet your needs.
Run the select, insert your when clause and then run the create or replace statements.
This won't work due to the trigger_body being a long datatype
select 'CREATE OR REPLACE TRIGGER '|| description
||trigger_body
from dba_triggers
where owner = 'Your schema'
but this should work if your triggers are not more than 4000 characters
select 'CREATE OR REPLACE TRIGGER '|| description
|| ADMIN.LONG_HELP.SUBSTR_OF('select trigger_body from dba_triggers where trigger_name = :0',
1,4000,'0',dt.trigger_name)
from dba_triggers dt
where owner = 'YourSchema';
CREATE OR REPLACE PACKAGE ADMIN.LONG_HELP
/******************************************************************************
NAME: LONG_HELP
PURPOSE: Read fields of type long. (commonly found in data dictionary)
REVISIONS:
Ver Date Author Description
--------- ---------- --------------- ------------------------------------
1.0 10/27/2011 1. Created this package. based on Tom Kyte's column here
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:839298816582
note that it only retrieves the first 4000 characters of any LONG column
USAGE in a WHERE
INSTR(
ADMIN.LONG_HELP.SUBSTR_OF('SELECT text from all_views where view_name =:o ',
1,4000,'o',m2.obj_name),m1.FK_ID) > 0
******************************************************************************/
--AUTHID CURRENT_USER
--removed to get around ORA-29470: Effective userid or roles are not the same as when cursor was parsed
--restrict usage to admin schema for Oracle 11g
AS
FUNCTION substr_of (p_query IN VARCHAR2,
p_from IN NUMBER,
p_for IN NUMBER,
p_name1 IN VARCHAR2 DEFAULT NULL ,
p_bind1 IN VARCHAR2 DEFAULT NULL ,
p_name2 IN VARCHAR2 DEFAULT NULL ,
p_bind2 IN VARCHAR2 DEFAULT NULL ,
p_name3 IN VARCHAR2 DEFAULT NULL ,
p_bind3 IN VARCHAR2 DEFAULT NULL ,
p_name4 IN VARCHAR2 DEFAULT NULL ,
p_bind4 IN VARCHAR2 DEFAULT NULL )
RETURN VARCHAR2;
END LONG_HELP;
/
CREATE OR REPLACE PACKAGE BODY ADMIN.LONG_HELP
AS
g_cursor NUMBER := DBMS_SQL.open_cursor;
g_query VARCHAR2 (32765);
PROCEDURE bind_variable (p_name IN VARCHAR2, p_value IN VARCHAR2)
IS
BEGIN
IF (p_name IS NOT NULL)
THEN
DBMS_SQL.bind_variable (g_cursor, p_name, p_value);
END IF;
END BIND_VARIABLE;
FUNCTION substr_of (p_query IN VARCHAR2,
p_from IN NUMBER,
p_for IN NUMBER,
p_name1 IN VARCHAR2 DEFAULT NULL ,
p_bind1 IN VARCHAR2 DEFAULT NULL ,
p_name2 IN VARCHAR2 DEFAULT NULL ,
p_bind2 IN VARCHAR2 DEFAULT NULL ,
p_name3 IN VARCHAR2 DEFAULT NULL ,
p_bind3 IN VARCHAR2 DEFAULT NULL ,
p_name4 IN VARCHAR2 DEFAULT NULL ,
p_bind4 IN VARCHAR2 DEFAULT NULL )
RETURN VARCHAR2
AS
/******************************************************************************
NAME: LONG_HELP.SUBSTR_OF
PURPOSE: CONVERT long data fields into VARCHAR2
WHOSE DATA IS CHANGED: none
WHAT USES THIS:
WHERE ARE THE RESOURCES NEEDED:
******************************************************************************/
l_buffer VARCHAR2 (4000);
l_buffer_len NUMBER;
BEGIN
IF (NVL (p_from, 0) <= 0)
THEN
raise_application_error (-20002,
'From must be >= 1 (positive numbers)');
END IF;
IF (NVL (p_for, 0) NOT BETWEEN 1 AND 4000)
THEN
raise_application_error (-20003, 'For must be between 1 and 4000');
END IF;
IF (p_query <> g_query OR g_query IS NULL)
THEN
IF (UPPER (TRIM (NVL (p_query, 'x'))) NOT LIKE 'SELECT%')
THEN
raise_application_error (-20001, 'This must be a select only');
END IF;
DBMS_SQL.parse (g_cursor, p_query, DBMS_SQL.native);
g_query := p_query;
END IF;
bind_variable (p_name1, p_bind1);
bind_variable (p_name2, p_bind2);
bind_variable (p_name3, p_bind3);
bind_variable (p_name4, p_bind4);
DBMS_SQL.define_column_long (g_cursor, 1);
IF (DBMS_SQL.execute_and_fetch (g_cursor) > 0)
THEN
DBMS_SQL.column_value_long (g_cursor,
1,
p_for,
p_from - 1,
l_buffer,
l_buffer_len);
END IF;
RETURN l_buffer;
END substr_of;
END LONG_HELP;
/