Home » SQL & PL/SQL » SQL & PL/SQL » 3D PLSQL table
3D PLSQL table [message #274422] Tue, 16 October 2007 00:53 Go to next message
caliguardo
Messages: 107
Registered: February 2007
Location: Chennai
Senior Member

Can anybody tell me the difference between Ordinary PLSQL tables and 3d PLSQL tables? When do we go for 3D PLSQL tables?
Re: 3D PLSQL table [message #274424 is a reply to message #274422] Tue, 16 October 2007 00:56 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
What are 3D PL/SQL Tables?

Regards
Michel
Re: 3D PLSQL table [message #274429 is a reply to message #274424] Tue, 16 October 2007 01:08 Go to previous messageGo to next message
caliguardo
Messages: 107
Registered: February 2007
Location: Chennai
Senior Member

Well, I really don't know about that. I have just gone through a document where they have blindly given 3d PLSQL tables without any frther information.
Re: 3D PLSQL table [message #274434 is a reply to message #274429] Tue, 16 October 2007 01:23 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Which document? Quote it! Put a link to it?
Did you find somtehing on Google? in Oracle documentation?
Post what you found.

Regards
Michel
Re: 3D PLSQL table [message #274439 is a reply to message #274434] Tue, 16 October 2007 01:34 Go to previous messageGo to next message
caliguardo
Messages: 107
Registered: February 2007
Location: Chennai
Senior Member

Well, I got it from my friend. Print outs stating that
Quote:

This Function Converts Composite Type objects into 3D PL/SQL
.
I will get the URL from him and post it later.
Re: 3D PLSQL table [message #274440 is a reply to message #274439] Tue, 16 October 2007 01:37 Go to previous messageGo to next message
Michel Cadot
Messages: 64132
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You can already tell us the name and author of the document.
And quote a little more than 9 words.

Regards
Michel
Re: 3D PLSQL table [message #274446 is a reply to message #274440] Tue, 16 October 2007 01:54 Go to previous message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
I think that caliguardo means the following:

When you think of a normal PL/SQL table as being two dimensional (row*column), is there a way to create an extra dimension? So you would have something like row*"depth"*column. In other words: can each row of an array, be an array of its own? Can one create this extra "dimension".
And yes, you can. You can create a table of a table.

I remember I once did this using Oracle 8i. The compiler didn't like it very much (I had a lot of ORA-600 errors while experimenting) but with forward declaration I succeeded. Note that it was an "academic exercise". I never really used it in real life code. I did post it on the PL/SQL pipeline of Steven Feuerstein but I don't know whether it is still available. I also asked the same question back then. I think if you search for "Multidimensional PL/SQL tables" in the forums it might pop up.

I must admit that the terminology used is a bit unfortunate but I understand. I had the same question back then...

Here's a small example using index-by tables:
set serverout on

DECLARE
   TYPE t_myrec  IS RECORD (col1 NUMBER, col2 NUMBER); -- 1 dimension
   TYPE t_numtab IS TABLE OF t_myrec  INDEX BY BINARY_INTEGER; -- 2 dimensions
   TYPE t_3dtab  IS TABLE OF t_numtab INDEX BY BINARY_INTEGER; -- 3 dimensions
  
   v_mytab t_3dtab;
BEGIN
   v_mytab(1)(1).col1 := 1;
   v_mytab(1)(1).col2 := 2;
   v_mytab(1)(2).col1 := 3;
   v_mytab(1)(2).col2 := 4;
   v_mytab(2)(1).col1 := 5;
   v_mytab(2)(1).col2 := 6;
   v_mytab(3)(1).col1 := 1;
   v_mytab(3)(1).col2 := 3;
   v_mytab(2)(2).col1 := 5;
   v_mytab(2)(2).col2 := 6;
   v_mytab(3)(2).col1 := 7;
   v_mytab(3)(2).col2 := 8;   
   v_mytab(1)(3).col1 := 9;
   v_mytab(1)(3).col2 := 0;            

   FOR dim1_idx IN 1 .. v_mytab.count
   LOOP
     dbms_output.put_line('Inner Table '||dim1_idx);
     FOR dim2_idx IN 1 .. v_mytab(dim1_idx).count 
     LOOP
       dbms_output.put_line('Record '||dim2_idx);
       dbms_output.put_line('Col1: '||v_mytab(dim1_idx)(dim2_idx).col1);
       dbms_output.put_line('Col2: '||v_mytab(dim1_idx)(dim2_idx).col2);
     END LOOP;
   END LOOP;
END;
/



MHE
Previous Topic: use of 'prior' function
Next Topic: Convert secons in hours more than 24
Goto Forum:
  


Current Time: Thu Dec 08 02:20:15 CST 2016

Total time taken to generate the page: 0.21931 seconds