PLSQL/ How to add values during iteration of associative array
Tag : sql , By : BinaryBoy
Date : March 29 2020, 07:55 AM
I wish did fix the issue. If you're working on oracle ,then this piece of anonymous block will work for you declare
TYPE parArray IS TABLE OF VARCHAR2(64) index by binary_integer;
v_parArray parArray;
arrayCount number;
lsPar parArray;
begin
v_parArray(1):='A';
v_parArray(2):='B';
v_parArray(3):='C';
arrayCount:=v_parArray.Count;
For i In 1 .. arrayCount
Loop
lsPar(i):=v_parArray(i);
End Loop;
arrayCount:=lsPar.Count;
For i In 1 .. arrayCount
Loop
dbms_output.put_line('The value of Ispar at index '||i||' is '||lsPar(i));
End Loop;
end;
The value of Ispar at index 1 is A
The value of Ispar at index 2 is B
The value of Ispar at index 3 is C
|
PHP empty function - Associative Array
Tag : php , By : user105769
Date : March 29 2020, 07:55 AM
may help you . From the manual documentation for empty(): foreach ($attributes as $key => $value) {
if (empty($value)) {
echo "'$key' is empty\n";
}
}
if(!array_filter($attributes)) {
echo 'All values are empty';
}
if (array_search('', $attributes) !== FALSE) {
echo 'One of the values in the array is empty';
}
|
PLSQL - Error in associative array
Date : March 29 2020, 07:55 AM
I wish this helpful for you Im trying to delete a set of tables and afterwards I want to recreate them using as select from. For couriousity I wanted to do this with an associative array. Unfortunately something is messed up, several errors appear and I can't find the reasons. This is the code: , You have some unterminated append operations || on lines: Dbms_Output.Put_Line('Dropping TABLE '|| L_Key ||);
EXECUTE IMMEDIATE 'create table schema1.' ||l_key||' as select * from schema2.'||l_tbl(l_key)||;
while elem is not null loop
dbms_output.put_line(elem || ': ' || var_assoc_varchar(elem));
elem := var_assoc_varchar.next(elem);
end loop;
|
Plsql return associative array function
Date : November 07 2020, 01:43 PM
I wish did fix the issue. You need to create type first, and then use if in function declaration. Create a package and declare type there. create or replace package my_pkg as
type textGroupArray IS TABLE OF VARCHAR2(30) INDEX BY BINARY_INTEGER;
FUNCTION createChecksumArray(checksumNumber VARCHAR2) RETURN textGroupArray;
end my_pkg;
/
create or replace package body my_pkg as
FUNCTION createChecksumArray( checksumNumber VARCHAR2 )
RETURN textGroupArray
is
..
TYPE textGroupArray IS TABLE OF VARCHAR2(30)
INDEX BY BINARY_INTEGER;
textGroups textGroupArray;
..
BEGIN
..
textGroups := textGroupArray();
..
(A LOOP)
-- add textgroup into the array
IF textGroup != 0 THEN
arrayCount := arrayCount + 1;
textGroups( arrayCount ) := TRIM( textGroup );
END IF;
(END THE LOOP)
..
RETURN textGroups;
end;
end my_pkg;
/
|
Select from PLSQL Associative array?
Date : March 29 2020, 07:55 AM
|