473,325 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

How to call a member procedure in a subclass/subtype? (object relational)

I want at this point call the member procedure AddVisita of one row where the object is a medico_ty in dipendente_tab
(gettin the row like this (think) select treat(value(d) as medico_ty) d
from dipendente_tab d
where d.cf=constant )
for fill a row of visita_tab and the nested table in paziente_tab(FaVisita) and dipendente_tab where dipendente is of medico_ty (FaVisita).
Like this d.AddVisita(par1,par2,par3,par4), is possible? how to make it?

This is the code(no syntax error):
Expand|Select|Wrap|Line Numbers
  1. 1)CREATE type Visita_ty 
  2.  
  3. 2)CREATE TYPE COLL_REF_VISITA_TY AS TABLE OF REF VISITA_TY
  4.  
  5.  
  6. 3)CREATE TYPE Dipendente_ty AS OBJECT
  7.  (
  8.     Nome VARCHAR2(20),
  9.     Cognome VARCHAR2(20),
  10.     Cf VARCHAR2(20),
  11.     DataN Date
  12.  
  13.  ) NOT FINAL
  14.  
  15.  
  16.  
  17. 4)CREATE TYPE Amministrativo_ty UNDER Dipendente_ty 
  18.    (
  19.    Livello NUMBER,
  20.    Mansione VARCHAR(20)
  21.    )FINAL
  22.  
  23.  
  24.  
  25. 5)CREATE  TYPE Medico_ty UNDER Dipendente_ty
  26.    (
  27.   Specialita VARCHAR(20),
  28.   FaVisita Coll_Ref_Visita_ty,
  29.   Reparto VARCHAR(20),
  30.   MEMBER PROCEDURE AddVisita (CF VARCHAR2,Data DATE,Tipo VARCHAR2,Ticket Number)
  31.   )FINAL
  32.  
  33. 6)CREATE TYPE Paziente_ty AS OBJECT
  34.  (
  35.    CF VARCHAR2(16),
  36.    NOME VARCHAR2(20),
  37.    COGNOME VARCHAR2(20),
  38.    FaVisita Coll_Ref_Visita_ty
  39.  )
  40.  
  41. 7)CREATE type Visita_ty AS OBJECT (
  42.     Tipo VARCHAR(20),
  43.     Data DATE,
  44.     Ticket number,
  45.     Paziente REF Paziente_ty,
  46.     Medico   REF Medico_ty
  47.     )
  48. 8)CREATE TYPE BODY Medico_ty is 
  49.       MEMBER PROCEDURE AddVisita(CF VARCHAR,Data DATE, Tipo VARCHAR,Ticket 
  50.                                                                   number) is
  51.       DECLARE
  52.           Visita Visita_ty;
  53.           RefPaziente REF Paziente_ty;
  54.       BEGIN
  55.           SELECT REF(P) INTO REFPAZIENTE
  56.           FROM Paziente_TAB P
  57.           WHERE P.CF=CF
  58.           VISITA :=Visita_ty(Data,Tipo,Ticket,RefPaziente,REF(SELF))
  59.           INSERT INTO Visita_TAB values Visita
  60.          INSERT INTO TABLE (SELF.FaVisita) VALUES REF(Visita)
  61.           INSERT INTO TABLE (SELECT P.FaVisita
  62.                          FROM PAZIENTE_TAB P
  63.                          WHERE P.CF=CF ) VALUES REF(VISITA)
  64.       END
  65.  
  66. 9)CREATE TABLE Paziente_TAB OF Paziente_ty
  67.     (CF PRIMARY KEY)
  68.      NESTED TABLE FaVisita
  69.                STORE AS PazienteFaVisita_TAB
  70.  
  71. 10)CREATE TABLE Dipendente_TAB OF Dipendente_ty
  72.        (CF PRIMARY KEY) 
  73.        NESTED TABLE TREAT(OBJECT_VALUE AS medico_ty).FaVisita STORE AS visite_tab
  74.  
  75. 11)CREATE TABLE Visita_TAB OF Visita_ty
  76.          (Paziente SCOPE IS Paziente_TAB,
  77.           Medico    SCOPE IS Dipendente_TAB)    
  78.  
  79. // some insert
  80.  
  81. INSERT INTO PAZIENTE_TAB (nome,cognome,cf,favisita)
  82. VALUES('rosario','brescia','ros80lit04edk19f',Coll_Ref_Visita_ty())
  83.  
  84. INSERT INTO PAZIENTE_TAB (nome,cognome,cf,favisita)
  85. VALUES('antonio','rosato','ant80lit04edk19f',Coll_Ref_Visita_ty())
  86.  
  87. INSERT INTO dipendente_tab values(medico_ty( 'rosario','manfredoina','rosak2442jk3','10-feb-1960','psicologia',
  88. coll_ref_visita_ty(),'psi1'))
  89.  
  90. INSERT INTO dipendente_tab values(medico_ty( 'manuele','doria','fafasd32442jk3','10-gen-1970','chirurgia',coll_ref_visita_ty(),'chi1'))
  91.  
Jan 20 '10 #1
2 2332
amitpatel66
2,367 Expert 2GB
Are you getting any runtime errors?
Jan 20 '10 #2
No runtime error, i run all the code and create normally table and type, and if i tried to insert manually it works ( i tried some query and go well) but insted of us all this (not clear) code below i wanna to use the AddVisita procedure for insert in the various nested table/visita_tab :

Expand|Select|Wrap|Line Numbers
  1. INSERT INTO visita_tab values('chirurgia','25-feb-2010',30,
  2.                                              (select ref(p)       
  3.                                               from paziente_tab p
  4.                                               where p.cf='ros80lit04edk19f'),
  5.                                              (select treat(ref(d) as  ref medico_ty)
  6.                                               from dipendente_tab d
  7.                                                where d.cf='fafasd32442jk3'))
  8.  
  9.  
  10. INSERT INTO TABLE
  11. (SELECT TREAT(value(D) AS Medico_ty).FaVisita 
  12. FROM Dipendente_tab d 
  13. where d.cf='fafasd32442jk3'
  14. )
  15. SELECT  ref(v)
  16. FROM visita_tab v 
  17. WHERE v.medico=(select ref(m) 
  18.                              from dipendente_tab m
  19.                               where m.cf='fafasd32442jk3')
  20.  
  21.  
  22.  
  23. INSERT INTO TABLE(
  24. SELECT FaVisita 
  25. FROM Paziente_tab P 
  26. WHERE p.cf='ros80lit04edk19f'
  27. )
  28. SELECT  ref(v)
  29. FROM visita_tab v 
  30. WHERE  v.paziente=(SELECT ref(paz) 
  31.                                     FROM paziente_tab paz
  32.                                     WHERE paz.cf='ros80lit04edk19f')
  33.  
  34.  
  35.  
Thx for the fast answer :).
Jan 20 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: george young | last post by:
I had developed the habit of using the neat python form: if someinstance: someinstance.memb() because it seems cleaner than "if someinstance is not None". {please no flames about "is not None"...
0
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft...
4
by: Eric A. Johnson | last post by:
Hi All, I have a class, ConsoleWindow, that is a member of another class, ConsoleLib, like so: class ConsoleLib { public: class ConsoleWindow { public:
6
by: Nels Olsen | last post by:
Our company is rewriting our product in .NET. The old product is in PowerBuilder, which is heavy on Hungarian notation. We are approaching the time where we have to finalize naming conventions for...
2
by: Mark Sisson | last post by:
Hi all. SITUATION ================ 1. I have a base class with a member variable that's an object 2. I have several classes that inherit from the base class. 3. There are several methods in...
3
by: seyiisq | last post by:
how do i implement a superclass and subclass relatioship of the type partial disjoint when creating the tables -- seyiisq...
6
by: Catch_22 | last post by:
Hi, I have a large SQL Server 2000 database with 3 core tables. Table A : 10 million + records Table B : 2 million + records Table C : 6 million + records One of the batch tasks that I...
8
by: Ruben | last post by:
Hi! I am looking for a way to get the name of a class-member as string, as example: class A { public string a; }
10
by: blangela | last post by:
If I pass a base class object by reference (likely does not make a difference here that it is passed by reference) as a parameter to a derived class member function, the member function is not...
20
by: billmaclean1 | last post by:
I need to write a stored procedure that selects from a table and returns the result set. I don't always know the TableSchema that I need to use when qualifying the table at run-time Example:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.