I don't have a lot of knowledge about PL/SQL, I did this script using a type object:
CREATE OR REPLACE TYPE num_array is table of NUMBER:
/
DECLARE
jobTypeId NUMBER;
jobs num_array:= num_array();
BEGIN
//some code
This code work fine, but now I don't have privilegies to create a type, then i am searching some alternative but how I said prviously I am not an expert about PL/SQL.
Any idea???
Thanks for your time and sorry for my english,It is not my native languaje.
Related
I am working on Oracle 11g NACHA eText rtf template and i am facing problems while creating this template as per Bank needs. I need help while using substring extended function in column Originating DFI Identification.
My function is like this: substr(BankAccountNumber,1,8)
But when, I test the template using template viewer i got following erorr:
[112616_130010213][][PROCEDURE] Log Level is changed to PROCEDURE
[112616_130011163][][ERROR] expression: is invalid
Time: 4.706 sec.
FO Formatting failed.
End of Process.
Anyone here can help me with this please ?
The syntax looks correct, try making it uppercase. Check to see if that tag contains any data, and that the datatype is Alpha in the etext template.
I need to trim instance name from complete dblink name .For example The select query returns result like HHVISDEV.TRINITI.COM. I need to get HHVISDEV. And ofcourse There are such multiple results. So I need to use cursor and print the final result. I am getting Warning: Procedure created with compilation errors., when I compile. And when I call the procedure I am getting ERROR at line 1:
ORA-06575: Package or function DELETEDBLINKS1 is in an invalid state. Can any one please guide me.
create or replace procedure DeleteDBLinks1 is
cursor mycursor is
SELECT SUBSTR(DB_LINK, 1, INSTR(DB_LINK, '.', 1, 1) - 1)
FROM dba_db_links;
myvar dba_db_links.dblinks%TYPE;
BEGIN
OPEN mycursor;
LOOP
FETCH mycursor
INTO myvar;
EXIT WHEN mycursor%NOTFOUND;
DBMS_OUTPUT.put_line(myvar);
END LOOP;
CLOSE mycursor;
end;
/
If you see Warning: Procedure created with compilation errors, then, I can guess, you compile your procedure in SQL*Plus. In SQL*Plus you can run command
show errors
and you will see errors list. Your procedure looks OK, so I think problem is - you have no access to dba_db_links view. Try to use all_db_links or user_db_links instead.
Along with what Dmitry said about you probably not having access to dba_db_links table, you also had a typo in the myvar variable definition. It should have been:
myvar dba_db_links.db_link%TYPE;
SQL*Plus> SHOW ERRORS will help you in your PL/SQL endeavors, until you start using a PL/SQL IDE like SQL Developer or (my favorite) PL/SQL Developer, which will show you the errors automatically.
I am trying to write a procedure that given a memory address and data type, will display the value of the data at that memory location.
I'm thinking that the best way to do this would be to use the To_Pointer function in the generic package Address_To_Access_Conversions, but every time I try to use it I get an error:
invalid prefix in selected component "Address_To_Access_Conversions"
I've ben unable to find any examples of how the Address_To_Access_Conversions is actually used. And I may be on the totally wrong track.
Does anyone know how to use the above package to convert an Address to an Access type and more importantly, a good way to access data at a given address to display to console?
Edit
The solution I found most in my research was to use something like the following:
for X'Address use dummy_address;
The only problem was that at that point in the code, I hadn't calculated what the dummy address was and that statement would only work at declaration, before 'begin' I found a way around this though with block programming:
dummy_address := base_address + offset;
Dummy_String:
declare
subtype Xdummy is Integer;
S : Xdummy;
for S'Address use dummy_address;
begin
--More code here
end Dummy_String;
--DROP FUNCTION tempscript();
CREATE OR REPLACE FUNCTION tempscript()
RETURNS integer AS
$BODY$
DECLARE
my_index TEXT;
b integer;
BEGIN
my_index := 'example_index';
RAISE NOTICE '% ', my_index;
reindex index my_index; /* problem with this line , we are not able to pass local variable as paramenter*/
b :=2;
return b;
END;
$BODY$
LANGUAGE
plpgsql VOLATILE
COST 100;
SELECT * from tempscript();
please find my comment in the above code where exactly i am facing the problem.
please let me know the solution or workaround.
Thank you.
Per the user manual, you can only use variables where query parameters are permitted. That doesn't include identifiers and utility statements.
You need to use the PL/pgSQL EXECUTE statement for dynamic SQL.
EXECUTE format('REINDEX %I', my_index);
Separately, if you need to automate REINDEXing then you're almost certainly doing something else wrong. It should not be necessary in most situations. Maybe you've turned autovacuum down too far so it's failing to keep up?
If you're writing a function for a one-off, use a DO block so you don't have to create, execute, and drop the function.
I have encountered this code... Is this Pl/Sql? What do you think it is?
[Script 1.0]
script package up is
import native def_1;
procedure p(
i_g text
)
is
l_txt text;
begin
with mem_m(idx) as msg do
with book_aud(evt_id) as book do
book.upd_pkt(
evt_nr => i__nr
,ref_nr => msg.h.id
,account_nr => msg.h.id
,status => '1'
);
end with;
end with;
end p;
I am surprised by import and end with;
It is not the full code. It is reduced version of it.
It also contained familiar elements such as:
c_max constant number := 95;
c_VE_BA constant text := 'A07000';
-- comment
if i_mt is null then
return rpad('/',16);
else
if i_id = zconst_.c_JPY then
l_fmt := '9999999999999999';
else
l_fmt := '9999999999999D99';
end if;
end if;
case i_typ_id
when def_typ.contr then
l_zuonr := zfx2.c_avqt;
when def_typ.fx then
l_zuonr := zfx2.c_avqd;
when def_typ.fxswap then
l_zuonr := zfx2.c_avqd;
when def_typ.forex then
l_zuonr := zfx2.c_avqd;
when def_typ.xfer then
l_zuonr := zfx2.c_avqd;
when def_typ.intr then
l_zuonr := zfx2.c_avqt;
else
assert(false,'Meta Typ');
end case;
It looks like an extension of Pl/Sql.
Based on the responses and my own research, I guess it is Avaloq+PL/Sql.
I contacted Avaloq,I am still waiting for official answer.
It looks like Avaloq Script, used by (ahem) Swiss banks, and while there is very little about it online, I found a grammar which perfectly matches the terms in your samples.
Avaloq Script, the Avaloq Banking
System's script language, facilitates
entering specific business logic. The
structure of the data that can be
accessed through Avaloq Script is
defined in a DDIC (Data Dictionary),
making it unnecessary to know the data
storage structure.
yes it is avaloq script. its some kind of pl/sql pre compiler, you should be able to find a package called s#up where the real pl/sql code resides.
It definitely is Avaloq Script. The code snippet is a script package that Avaloq compiler compiles into PL/SQL. The point of Avaloq Script is to disallow direct database access and make the customizer of the Avaloq product to use the Avaloq API instead. The API is the Avaloq script language and a whole array of other ways like setting up rule tables to be loaded or special syntax to define forms, reports, workflows etc. often allowing snippets of Avaloq script within that other kind of sources.
Avaloq script has many PL/SQL elements but also some VB language concepts can be found. Here are some comments in the code to give some idea what the code means.
[Script 1.0] -- Have not seen other than 1.0 version
script package up is -- The PL/SQL package name is going to be s#up
import native def_1; -- import native means a PL/SQL package named
-- def_1 can be used, without native it is
-- another Avaloq script package
procedure p( -- declares a procedure with the name "p"
i_g text -- input variable i_g defined text.
-- in PL/SQL this becomes a VARCHAR2
)
is
l_txt text; -- local variable VARCHAR2(4000) in PL/SQL
begin
with mem_m(idx) as msg do -- mem_m is a DDIC (Data Dictionary)
-- It actually is a kind of "class" with
-- fields and methods
-- "with" is like in VB to avoid writing
-- mem_m(idx) all the time e.g. mem_m(idx).h.id
with book_aud(evt_id) as book do -- book_aud is another DDIC that it is not
-- prefixed with mem implies this is not a
-- in memory structure but direct access
-- to a Oracle table book_aud with index
-- evt_id which looks undefined to me and
-- should bring a compiler error
book.upd_pkt( -- method call in the book_aud DDIC
evt_nr => i__nr -- like in PL/SQL named parameters
,ref_nr => msg.h.id
,account_nr => msg.h.id
,status => '1'
);
end with;
end with;
end p;
I could also comment on the other code snippet above but I think you already get out the general concept. Neither mem_m nor book_aud is a known DDIC in the Avaloq version I am working with, wonder where you got it from. Since your post is many years old I suppose this was a very old Avaloq release.
I'm sure that isn't PL/SQL.
I know this doesn't directly answer your question but I might suggest that you go though the list here. It might be listed in here. There are several examples of programs in different programming languages. It may be hard to 100% identify the language unless someone happens to recognize it and finds a "finger print" to prove the language... Do you have more examples you could post?
http://www.ntecs.de/old-hp/uu9r/lang/html/lang.en.html
I don't think that is a functional language. Knowing this might help narrow your search.
The only language I can think of offhand that has "with...end with" syntax is visual basic. Could this be some scripting form of VB?