Run the procedure by table number
HelloOracle 11.2.0.1
Windows
Create the np_type type is varray (3) of the number
/
Create the cn_type type is varray (3) the number;
/
Create the cxn_type type is varray (3) of varchar2 (2000)
/
I created the TEST table by pl/sql block below:
declare
execstr varchar2 (2000): =' create table test(';)
Start
because me in 1.80 loop
execstr: = execstr | 'col ' | TO_CHAR (i) | 'number,';
end loop;
execstr: = substr (execstr, 1, length (execstr)-1);
execstr: = execstr | ')';
dbms_output.put_line (execstr);
run immediately execstr;
end;
/
create the table sp_table (Splitid number, Delimiterlength number);
insert into sp_table values (1.4);
insert into sp_table values (2.7);
insert into sp_table values (3.9);
insert into sp_table values (4.1);
insert into sp_table values (5.2);
insert into sp_table values (6,6);
create or replace procedure myproc1
(
STRX in varchar2, delarray in np_type)
as
execstr varchar2 (2000);
CN cn_type.
CXN cxn_type;
XPos number: = 1;
Start
execstr: = ' insert into test values(';)
because loop me in 1.3
Select Delimiterlength in the sp_table (i) cn where Splitid = delarray (i);
CXN (i):=substr(STRX,XPos,CN(i));
execstr: = execstr | CXN (i) | ',';
XPos: = (i) cn + xpos;
end loop;
execstr: = RTRIM (execstr, ','). ')';
dbms_output.put_line (execstr);
-execution immediate execstr;
end;
/
SQL> declare
2 v np_type:=np_type(4,4,4);
3 begin
4 --dbms_output.put_line(v(3));
5 exec myproc1('111',v);
6 end;
7 /
exec myproc1('111',v);
*
ERROR at line 5:
ORA-06550: line 5, column 8:
PLS-00103: Encountered the symbol "MYPROC1" when expecting one of the
following:
:= . ( @ % ;
The symbol ":=" was substituted for "MYPROC1" to continue.
SQL>
The procedure above will insert the numbered string supplied in the test table that splits the chain numbered inspires provided splitids of sp_table.In fact, I tried to help a member of the forum for his question, but I'm not get where I get the above error. Of course, there is little that miss me, but not that. This thread is running too in this forum.
Please help me.
Concerning
Girish Sharma
create or replace procedure myproc1
(
strx in varchar2, delarray in np_type)
as
execstr varchar2(2000);
cn cn_type := cn_type(null, null, null);
cxn cxn_type := cxn_type(null, null, null);
xpos number:=1;
begin
execstr := 'insert into test values(';
for i in 1..3 loop
select Delimiterlength into cn(i) from sp_table where Splitid = delarray(i);
cxn(i):=substr(strx,xpos,cn(i));
execstr :=execstr || cxn(i) || ',';
xpos :=cn(i) + xpos;
end loop;
execstr := RTRIM(execstr,',')|| ')';
dbms_output.put_line(execstr);
--execute immediate execstr;
end;
/
and
declare
a1 number :=4; a2 number :=4; a3 number :=4;
v np_type:=np_type(a1,a2,a3);
begin
for i in 1..3 loop
dbms_output.put_line('v(' || i || ') = ' || v(i));
end loop;
myproc1('111',v);
end;
/
Your varrays are null or empty in myproc1
Tags: Database
Similar Questions
-
Cannot run the procedure several times
Hello
I use oracle 12 c
I just created a stored procedure that works very well
Problem is that the second time I run it, it does not what it should (data fusion)
When I run the second time I always get PL/SQL procedure successfully completed but the target table is still empty, here is the procedure:
1 create or replace procedure MERGE_TABLEA
2 as
3. start
4 MERGE TABLE_A has B (SELECT 'ID', 'NAME' OF TABLE_B) with the HELP of
ON (A.ID = B.ID)
WHEN MATCHED THEN
UPDATE SET B.SID = B.NAME
WHEN NOT MATCHED THEN
INSERT (A.' ID',' NAME')
VALUES (B.ID, B.NAME);
END;
/
PL/SQL procedure successfully completed.
I also tried to build a simple procedure that id just insert and name of the table to test ina and it works very well, no matter how many times I've run it
Is it maybe something with the merger or what?
Thank you!
OK guys, I think there are some misunderstandings here,
@ddf_dba_ifox , version of the db that I use is stated in the first line of my post, I can't publish data for security reasons
@rp0428 I forgot to mention that I'M to truncate the table, and then run the procedure again but the merger no longer works as the table is empty
In any case, I found out why
I'm merging the tables in the DB using the schema that is related to my installation of Oracle APEX
In the procedure if you notice there is no COMMIT
As apex has users within a schema, that I couldn't see the lines without committing before
Thank you all anyway!
-
Hello
I'm able to run this procedure.
I created the procedure successfully.
CREATE OR REPLACE PROCEDURE update_LOGIN_TABLE (NAMER OUT VARCHAR2)
IS
temp_num NUMBER;
BEGIN
temp_num: = 10;
DBMS_OUTPUT. Put_line (temp_num);
Setting a DAY to the USER SET NAME = 'Ranga' where NAME = NAMER;
COMMIT;
EXCEPTION
WHILE OTHERS THEN
ROLLBACK;
END update_LOGIN_TABLE;
*/*
It comes to my Table Structure:
SQL > select * from users;
PASS NAME
-------------------- --------------------
Sai Baba
SAI Natha
roux keyboard
roux keyboard
When I tried to run, I get this: execute update_LOGIN_TABLE ('good');
SQL > execute update_LOGIN_TABLE ('good');
BEGIN update_LOGIN_TABLE ('good'); END;
***
ERROR on line 1:
ORA-06550: line 1, column 26:
PLS-00363: 'delighted' expression cannot serve a purpose of assignment
ORA-06550: line 1, column 7:
PL/SQL: Statement ignoredupdate_LOGIN_TABLE (NAMER OUT VARCHAR2)
I think you probably wanted an IN argument in your procedure.
-
Run the procedure after the application deployment
Hi all
I faced a small question.
When I deploy my application to another server - it must run a procedure (this means that the procedure must be run once immediately after successful deployment).
It takes to update some records in the system tables.
Apex supports characteristic or something like that?
APEX 4.1
Thank you
Published by: Rod 13.05.2013 confidence 0:56Cane Trust wrote:
I faced a small question.
When I deploy my application to another server - it must run a procedure (this means that the procedure must be run once immediately after successful deployment).
It takes to update some records in the system tables.Apex supports characteristic or something like that?
APEX 4.1
How do you deploy your application? The documentation contains all the details of creating a packaged application with all dependencies for database included as items of support. Your procedure must be performed in one of these objects support scripts.
-
Apex 4. Run the procedure to recover my files
Dear all,
I experience a problem moving my apex application (sss) to a new server.
I export demand for 3.2 APEX to APEX 4.0 new
+ transfer of data using a simple DB dump (export).
Everything will work perfectly except our main application functionality, sitting on the workspace of "HR_PRD" that we have a few problems.
In our DB schema called "HR_REP" I have a table that stores BLOBs for download a document attached to a record of the employee.
So I created a package that contains the custom procedure to download the files stored in the table "wr_docs".
URL = http://sphfrapex01.hopfr.net.fr.ch:8080/apex/HR_PROD.wr_apputil.download_my_file?p_file=3655106341169143
I can download the file whithout any problems and it appears correctly in the report showing all my files.
BUT when it tries to download... Unfortunately, access to the file does not work on the new APEX 4.0 platform!
As this sounds like a simple question 'rights', I did several tests...
I tried to create a simple procedure on my 'old' server called 'TEST' which simply print a simple text:
HTP. ("test to print something");
Here, I granted AUDIENCE to perform this procedure.
It works well on the APEX 3.2 platform when on the new APEX 4.0, refusal to execute the procedure.
Can you help me please?
I'm certainly missing something obvious thanks to the GRANT run the TEST at?
I granted AUDIENCE, so the appeal should work...
I have to admit, I'm a bit lost here.
Thanks in advance for your help.
Philippe KilchoerHi Philippe,.
using EPG to APEX? You may have forgotten to update WWV_FLOW_EPG_INCLUDE_MOD_LOCAL to include your procedure. Take a look on
http://download.Oracle.com/docs/CD/E14373_01/AppDev.32/e13363/up_dn_files.htm#CJACBEHG
Concerning
Patrick
-----------
My Blog: http://www.inside-oracle-apex.com
APEX 4.0 Plug-Ins: http://apex.oracle.com/plugins -
Create the procedure, truncate table
When I run the following, I get the following error:
on the 'truncate table BASE;' line in the following text:PLS-00103: Encountered the symbol "TABLE" when expecting one of the following: := . ( @ % ;
Can someone tell me what I am doing wrong?CREATE OR REPLACE PROCEDURE TransferData IS BEGIN --clear current tables to allow for clean data truncate table BASELINE; truncate table TREATMENT; truncate table FOLLOWUP; truncate table WITHDRAW; END;
Thank you!TRUNCATE is not DML, DDL, but you will need the dynamic SQL statements here:
CREATE OR REPLACE PROCEDURE TransferData IS BEGIN --clear current tables to allow for clean data execute immediate 'truncate table BASELINE'; execute immediate 'truncate table TREATMENT'; execute immediate 'truncate table FOLLOWUP'; execute immediate 'truncate table WITHDRAW'; END;
-
How to call the procedure type table
Hi I have the below requirement
Created in the sub table type
CREATE or REPLACE the TYPE char_type IS the TABLE OF VARCHAR2 (4000);
create or replace procedure test_proc_type (p_type char_type) is
Start
I'm looping 1.p_type.count
dbms_output.put_line (p_type (i));
end loop;
end;
How to call the procedure with parameter as a type!
SQL> create or replace type char_type as table of varchar2(4000) 2 / Type created. SQL> create or replace procedure test_proc_type (p_type char_type) 2 is 3 begin 4 for i in 1..p_type.count loop 5 dbms_output.put_line (p_type(i) ) ; 6 end loop; 7 end; 8 / Procedure created. SQL> set serveroutput on SQL> SQL> exec test_proc_type(char_type('A','B','C','D','E')) A B C D E PL/SQL procedure successfully completed. SQL>
-
results of the procedure in table
Hello
I have a procedure and I want to transfer of result of the procedure at a table. How can I do this?
is this possible?So I need to transfer the results of this procedure in table... Because I have to make a graph on the APEX. Apex has so only the sql command to make the chart.
ESRA
In order to return the results in the table set, please check:
http://www.gokhanatil.com/2011/02/Oracle-table-functions.html
http://www.Oracle-base.com/articles/9i/PipelinedTableFunctions9i.php
Concerning
Grosbois
-
Run the procedure works without slash
It's weird.
I'm in a plsql connected to a database session.
I can run a procedure as follows:
run status_pkg.check_owner_vcard (1,1,2);
However, I would like eventually to use variables, but when I try to do something like this:
SQL > declare
2 start
3 run status_pkg.check_owner_vcard (1,1,2);
4 end;
7 m
run status_pkg.check_owner_vcard (1,1,2);
*
ERROR at line 3:
ORA-06550: line 3, column 9:
PLS-00103: encountered the symbol "STATUS_PKG" when awaits an of the
Next:
:= . (@ %; immediate)
The symbol ': = ' was replaced by 'STATUS_PKG' continue.
It is not a function - procedure which could wait for oracle?
Any help appreciated
Rgds
Petersqlplus command does not work inside a plsql block. Remove it and your block should run.
-
Hello world
I am trying to execute the procedure below,
CREATE or REPLACE procedure test1 (n1 n2 in number, number, tot OUT number)
is
i the number: = null;
Start
loop
If n2 > n1 then
i: = i + 1;
tot: = n1 + i;
dbms_output.put_line (tot);
elsif n2 < 1 then
dbms_output.put_line ('enter a higher value for n2');
end if;
end loop;
end;
/
All I'm trying to do is to print the numbers according to the values we give during execution, but doesn't seem to work for me.
IE.,.
N1 = 1;
N2 = 5;
tot = 1,2,3,4,5;
I'm sorry if there is a mistake in the procedure and would be really grateful if you can help me with this. Thanks in advance for your help.
Published by: Pravin on August 31, 2010 14:25If you want you can use this code it has the same logic
CREATE OR REPLACE procedure test1(n1 IN number, n2 IN number, tot OUT number) is cnt number := 0; begin if n2 < n1 then dbms_output.put_line('Enter a higher value for n2'); end if; for i in n1 .. n2 loop dbms_output.put_line(i); cnt := cnt + 1; end loop; tot := cnt; end test1;
-
I have a procedure files and creating sequences that are used as serial numbers for some forms.
For the moment, the admin user must click on a button, once a year to perform the procedure.
I need to do this automatically every year eg 06:00 on 1 January.
Can someone point me in the right direction
GusHello
At least you have some time to think about it! ;)
Have a look/google for DBMS_SCHEDULER - which should sort out you.
See you soon
Ben
-
How to run the procedure which parameter is in a single query
Hi all
Here's sinario
create or repalce procedure proc1 (number, number xyz, sys_refcursor Prefcur abc)
as
Start
...
......
... do something...
end;
front end, all paramertes came as string...
'proc1 (1,5,Prefcursor).
now what I do is that I created an another procedure that accept this string as parameter.
create or replace procedure proc2 (Vpstring varchar2, Prefcursor to sys_refcursor)
as
Start
execute Vpstring;
end;
but it gives me error
Please help me solve this problem.
any help appriciatedIt looks like a very strange requirement for me.
Try like this.
SQL> create or replace procedure p1(a1 number, a2 number, a3 out sys_refcursor) 2 as 3 begin 4 open a3 for select * from dual where a1 = a2; 5 end; 6 / Procedure created. SQL> create or replace procedure p2(str varchar2, rc out sys_refcursor) 2 as 3 lstr varchar2(100); 4 begin 5 lstr := 'BEGIN ' || substr(str,1,instr(str,',',1,2))||':1);' ||' END;'; 6 7 execute immediate lstr using rc; 8 end; 9 / Procedure created. SQL> var rc refcursor SQL> exec p2('p1(1,1,rc)',:rc) PL/SQL procedure successfully completed. SQL> print rc D - X SQL> exec p2('p1(1,2,rc)',:rc) PL/SQL procedure successfully completed. SQL> print rc no rows selected SQL>
Thank you
Knani. -
Hi Experts,
We load data from .txt files in Linux server into a table.
Scenario runs perfectly when running Windows ODI GUI (on linux agent.we have two agents who perform one is windows and Linux).When we try to run it from the command line using startscen.bat getting following error.
ODI-1227: SrcSet0 (load) task fails on the source FILES FILE_SERVER connections.
Caused by: java.sql.SQLException: ODI-40438: file not found: /loadfiles/Test/xyz.txt
By this mistake if we conclude that this file may not exist... But it works well to GUI.
Infact we have given 777 permissions to file.
Ideas please share...
Concerning
PrakashV
Hi all
It works very well by adding the URL of the AGENT in a syntax such as startsen
StartScen.bat FILE_TO_ORACLE 001 GLOBAL-NAME = OracleDIAgent3-AGENT_URL =http://10.64.165.73:20912 / oraclediagent
-
Try to run the procedure and get an error PLS-00103
I have a procedure defined with these parameters
create or replace PROCEDURE procAuth
(
EMAIL IN VARCHAR2,
PASSWORD IN VARCHAR2,
IP IN VARCHAR2,
UL NUMBER
)
Using this code
var x number
procAuth exec ('[email protected]', ' 555555 ', ' 1.1.1.1': x);
print x
gives me
Error at startup on line 2 of the command:
procAuth exec ('[email protected]', ' 555555 ', ' 1.1.1.1': x);
Error report:
ORA-06550: line 1, column 65:
PLS-00103: encountered the symbol "" when expecting one of the following values:
. ( ) , * @ % & | = + - <>/ at is mod not rank rem = >
.. < an exponent (*) > <>or! = or ~ = > = < = <>and or as
between |
The symbol ',' was replaced by ' ' to continue.
06550 00000 - "line %s, column % s:\n%s".
* Cause: Usually a PL/SQL compilation error.
* Action:
x
------
Thanks for any helpjerry8989 wrote:
I have a procedure defined with these parameterscreate or replace PROCEDURE procAuth
(
EMAIL IN VARCHAR2,
PASSWORD IN VARCHAR2,
IP IN VARCHAR2,
UL NUMBER
)Using this code
var x number
exec procAuth (' [email protected]', '555555',' 1.1.1.1': x);
print xgives me
Error at startup on line 2 of the command:
exec procAuth (' [email protected]', '555555',' 1.1.1.1': x);a comma is perhaps missing to the right of the right like apostrophe below?
procAuth exec ('[email protected]', ' 555555 ', ' 1.1.1.1',: x);
-
How can I perform this procedure
create or replace procedure hr.testemp ( in_empno in number, out_name out varchar2, many_found_ out varchar2, err_i out varchar2, err_msg out varchar2 execute hr.testemp(09998,null,null,null,null)
Hi Alex,
you need a few variables that can receive your output settings.
Try something like this:
declare out1 varchar2(100); out2 varchar2(100); out3 varchar2(100); out4 varchar2(100); begin hr.testemp(09998,out1,out2,out3,out4) ; end; /
concerning
Kay
Maybe you are looking for
-
Example VI "convert LPT I2C"?
Hello! I convert data from an LPT in I2C interface! Is this possible? Anyone know an example VI for this problem? Kind regards Patrick
-
Paper not pulling from the correct TRAY
You already have a printer (Officejet) double tray and can't seem to get the correct tray. Here are some tips that may help you resolve this problem. The reason why you have this problem, because the 2nd TRAY is not apart from the printer DRIVERS. So
-
HP Pavilion touchsmart 14 n04: how to disable the bios password
1.i do not know how to disable bios password help me please. I remember my bios password, but I am not as he asks me if I opened my HP my hp Pavilion touchsmart 14 n042tx product 2.i have to donwgrade 8 window to window 7 help me if I want to switch
-
Since this morning, the other computers ('other' meaning other than mine, where "mine" is the one that has the connection to the router wireless connected to the internet) in my house does not "see" the family network. In other words, only my comput
-
The files and fonts will not be open in the creative cloud desktop application?
I downloaded new applications of 2015 using my Creative Cloud Desktop App. Since downloading the app CC does not connect the fonts or the files. All the other features seem to work normally. I don't know if it's related, but Adobe Illustrator does no