Explicit assignment to the ref parameter in member function doesn't work
I've created new member procedure in a simple DB schema (Profesor-Asignatura-Departamento). In this procedure I'd like to change explicitly the value of departamento parameter which stores references to departamento objects.
So what I'm doing is:
select ref(d) into ref_departamento from departamento d where d.codigo=n_departamento; -- retrieve reference to the departament which has a code=n_departamento
then I'd just like to assign the result to objects attribute like this:
self.departamento:=ref_departamento;
and here it doesn't work and I'm wondering why; I haven't found explaination in web. No error is displayed, simply it doesn't change the previous value of the parameter.
Maybe there are some restrictions. I've managed to find another solution here with UPDATE statement but I'm curious why the simple assignment doesn't work.
Thanks in advance,
Wojtek
OK, I'm not spanish however I like my code to be kept that way because I'm still learning :)
Most important classess are these (then tables are created for them):
create or replace type ot_departamento as object
codigo number,
nombre varchar2(32),
telefono vt_telefono, -- vector type of size 3
profesores tt_departamento_profesores, -- table type of references to ot_profesor objects
asignaturas tt_departamento_asignaturas -- table type of references to ot_asignatura objects
create or replace type ot_profesor as object
codigo number,
nombre varchar2(32),
direccion ot_direccion, --object type with street, city, etc.
telefono vt_telefono,
departamento ref ot_departamento, -- reference to ot_departamento
docencia tt_profesor_docencia, -- table type of objects which attributes are (reference to ot_asignatura, credits for a subject)
create or replace type ot_asignatura as object
codigo number,
nombre varchar2(32),
departamento ref ot_departamento, -- reference to ot_departamento
docencia tt_asignatura_docencia, -- table type of objects which attributes are (reference to ot_profesor, credits for a subject)
member procedure cambio_departamento(n_departamento number) *<- That's the procedure, where I had this issue* its task is to change current department,it takes as an argument code of new department which needs to be assigned
So now the code for my procedure is:
create or replace
type body ot_asignatura as
member procedure cambio_departamento(n_departamento number) is
asig_count number:=self.docencia.count;
no_cambio exception;
docencias_adscritas exception;
ref_departamento ref ot_departamento;
begin
--first check if a department of given code (n_departamento) exists at all, if not then raise NO_DATA_FOUND exception
select ref(d) into ref_departamento from departamento d where d.codigo=n_departamento;
--check if the given department is not the same as asignatura has already assigned, if so then raise NO_CAMBIO (NO_CHANGE) exception
if ref_departamento=self.departamento then
raise no_cambio;
end if;
--if there are any docencias (subject is declared with professor who's teaching and credits) already assigned to current department then department can't be changed
if asig_count>0 then
raise docencias_adscritas;
end if;
--first delete our assignatura from list of assignaturas already assigned to current department in the corresponding ot_department
delete from the (select d.asignaturas from departamento d where ref(d)=self.departamento) a
where a.COLUMN_VALUE.codigo=self.codigo;
--now assing (update) to current assignatura reference to the new department
--self.departamento:=ref_departamento; <- THIS IS NOT WORKING HERE*, so the workaround is given below by using explicit UPDATE on the whole table
update asignatura a set a.departamento=(select ref(d) from departamento d where d.codigo=n_departamento)
where a.codigo=self.codigo;
--what's left is to add current assignatura to the list of assignatures for new ot_departamento
insert into the (select d.asignaturas from departamento d where d.codigo=n_departamento)
select ref(a) from asignatura a where a.codigo=self.codigo;
exception
when no_data_found then
raise_application_error(-20003,'No hay este departamaneto');
when no_cambio then
raise_application_error(-20002,'Asignatura ya adscrita a este departamento');
when docencias_adscritas then
raise_application_error(-20001,'Asignatura tiene docencias adscritas !!!');
end cambio_departamento;
end;
I hope it's quite clear here. I'm still curious, why it's not working.
Thanks,
Wojtek
Similar Messages
-
What is the problem when your camera function doesn't work and lags?
What's the problem when the camera function doesnt work and lags? Can my iPod touch be returned because of this? I have done nothing to damage the product.
My file association for jpg files is correct, if i click on a
jpg, ACDSee starts immediately.Although I am a long time Windoze non-user, I vaguely remember that there's a difference between correct file-type association being set and some application starting at a mouse click on a file icon. I also vaguely remember Windoze file-type association mechanism uses a few action-types. Java Desktop should expect a specific action-type for the association. -
I have an iPod Classic and the latest version of iTunes. I make all my purchases on my computer, but when I try to click the "add to" option and transfer the songs to my iPod, it doesn't work. How can I get my songs from my computer to my iPod?
See this excellent user tip from another forum member turingtest2 outlining the different methods and software available to help you copy content from your iPod back to your PC and into iTunes.
Recovering your iTunes library from your iPod or iOS device
B-rock -
The Bluetooth on my 2012 Lexus doesn't work with my iPhone 5. My old android worked perfectly with my car. Even the tech specialist at Lexus couldn't get it to work. Lexus said that other iPhone 5s were having the same problem. What is apple doing to fix this?
Going to the local Apple store this morning...
My problem is not uncommon as the board is showing signs of this happening to many others as well. That is where I found the restore and reboot information to try to solve the issue of crashing apps.
I understand that Apple will not "give away the cow", but letting iPhone users know that the problems they are having are being addressed by Apple is a little more comforting than nothing at all. Other wise, all the apps in world are useless and even more importantly worthless, if a person has to reset/reboot/reload just to get them to work.
IF Apple can not address the basic problems with todays iPhone apps, why should one believe that the iPhone 3.0 OS is any better? Using a PC comparison, which is better, XP or Vista. If the current iPhone OS of 2.2. what ever is not working that well (as related to down loaded apps and iTunes), will OS 3.0 be any better?
The waste of time I refer to is in going to the apps store and downloading the apps... Again why by apps if the free version does not work? -
I am trying to "personalize" my cs2 software online download with the serial number from my original boxed cd set and it didn't work. I tried using the download serial number and that doesn't work either. Need help!
I understand that you have also used the download link & serial number from Adobe - CS2 Downloads, if still the CS2 is not working, then please refer to the system requirement for e.g System requirements | Photoshop
The issue can be that the present operating system might not be compatible with the CS2.
Regards
Rajshree -
The to_date function doesn't work ?
Hello
I don't know why my to_date function doesn't work on my pc.
my statement is pretty complex so i just tried simple one
select to_date('10-Jan-2006','dd-mon-yyyy') from dual;
but even this one doesn't work it says it is invalid month
howcome?
is it because my Windows XP (not english version) doesn't recognise month Jan?
i tried it another place it worked
so is there any language pack / patch i need to install? ?
so does OS matters?
or how to fix this..please help meBy default SQL Developer picks up it's language settings up from (on Windows) the Regional and Language Options. You can see what it has set by querying the NLS_SESSION_PARAMETERS view.
Assuming you don't want to change to using DD-MM-YYYY formats for your months or change your regional settings on your PC, you need to tell SQL Developer which language you want, which you can do by adding the following lines to the file sqldeveloper\jdev\bin\sqldeveloper.conf:
AddVMOption -Duser.language=en
AddVMOption -Duser.country=US -
I just downloaded the updates and now my mail doesn't work. It says I now need a newer version of OS to allow I've to open my mail which I can't right now
What version of the OS X are you running? Go to the Apple in the upper left corner and select About This Mac and report the Version back here.
-
I upgraded my 3 yr old iMac to Snow Leopard (OS X 10.6) and now my HP C4150 Scanning function doesn't work (not recognized). I downloaded updated Drivers from the HP site and installed them, but still no joy. Any suggestions?
aspaceman,
Perhaps I owe you an apology. Having re-read that downloading from HP was unsuccessful I feel uncomfortable. Can I suggest you update your 10.6 system (as noted in your profile) to 10.6.8 (if it is not already there) by using the
Mac OS X 10.6.8 Update Combo v1.1 combo update plus any software updates that then apply. -
Upgraded to os7 and done my updates on the apps as they appear.. Any function to do with the iBook store is not working or visible. The purchase at the end of a sample book doesn't work either. Anyone have a solution?
Upgraded to os7 and done my updates on the apps as they appear.. Any function to do with the iBook store is not working or visible. The purchase at the end of a sample book doesn't work either. Anyone have a solution?
-
i have made many purchase on app but when i want to made an in-app purchase of a game, it appears "your purchase could not be completed". i have disabled the restriction already but it still doesn't work. anyone can give a hint or a hand here? cheers~~~
http://www.apple.com/support/itunes/contact/
-
Before I upgraded my iPad mini, you could turn off apps to save battery power by double clicking the control button and then holding your finger on the app button until the minus sign appeared. That doesn't work anymore. How do you turn off the apps with ios7
Now you swipe downward, the app will appear and you delete, keep scolling to the right as in the past. With the new operating system you also swipe downward to get the search bar to find an app
-
Lightroom 5.7.1, Yosemite OS X - Synchronise Folder function doesn't work in Lr.
Is there a compatibility issue? I can see the folders/images in Finder but when trying to synchronise folders in Lr it does not recognise that there are any images and therefore unable to import to catalogue. Anyone has any idea how to make it work. Thanks a lot.Hi Elba,
Thank you very much for your reply. Not sure, however, that we are talking about the same problem.
I am trying to perform the same function in Lr that I have been doing for many years in the past and has only been a problem in the last few days (possibly coinciding with upgrading to Yosemite, trying to find out whether that is the problem)
I am not intending to sync any files with Creative Cloud but only trying to use 'Synchronize Folder' function in Lr. Normally, I would right click on a particular folder in Lr catalogue and click on that function to check that the Lr Catalogue is perfectly matching my drives where the original photos are actually stored.
The problem that I only started to encounter is that I can see the files on the actual drives but they do not appear in my Lr Catalogue and they are completely invisible to Lr. I simply can not get Lr to recognise them and then import them to catalogue.
If for example, I export images to Ps and then save and close them, they do appear on my drive but are invisible to Lr and I can't get them imported into the catalogue. Import to folder also not producing any results as they are still invisible to Lr.
Completely baffled by it. Any idea what could be the reason?
Kind regards,
Nik -
The speakers on my iphone 4s doesn't work to ring or to play music how do I fixes it?
The speakers on my iphone 4s doesn't work to ring or to play music how do I fixes it?
Try resetting your phone by pressing and holding both your home and power button at the same time for about 15-20 seconds till the apple logo appears ..
Hope it works out for u :) -
TS1398 The internet on my Iphone 4 doesn't work when I use the Wifi
The internet on my Iphone 4 doesn't work when I use the Wifi at home. My Mac works fine. On the Iphone it shows it's connected but it doesn't open any app. Anyone knows what to do? Thanks
Ÿ. If you tap and hold the "Y" does it appear? If so, just slide your finger up to select.
-
How can i stop the i tune pop force quit doesn't work
hi ,
please help " how can i stop the i tune pop force quit doesn't work"Refunds on downloaded software are virtually nonexistent.
I have had cases where I purchase software on a physical disk. If I don't like the software I can uninstall it from my computer and sell it legally. Recouping most of my loss.
Maybe you are looking for
-
How to see the file at the application server
HI TO ALL SDNERS , THIS IS MY CODE WHERE TO CHECK THE DOWNLOADED FILE AT THE APPLICATION SERVER.IN TCODE AL11 I HAVE SEEN THERE IS NO FILE GETTING CREATED.WHEN TRANSFERRING THE SY-SUBRC VALUE IS ZERO. Program Name
-
SAP_HTTPServicePort URLs in SLD for PI are updated by SLD host name itself
We have upgraded our PI 7.0 to 7,1. We have a central SLD. After the upgrade, SAP_HTTPServicePort URLs (in SLD Content maintenance) for the PI are all getting initialized with SLD host name itself. Example: for port.CIDX.af.pip.<PIPhostname> URL: htt
-
Hi, Is it possible to display an attachment in the SAP-Inbox along with work item. Please give some inputs. Thanks, Lakshmi.
-
Is there a way to remove the pulldown tab?
Is there a way to remove the pull down tab that shows weather, stocks, reminders and ect? It's very annoying and even gets triggered while in other apps while unwanted. In fact its one of the worst ideas they have ever added to the ipod. If I wanted
-
Local Storage Used When Using iMatch?
I'm using iMatch and streaming music to my iOS device. I'm curious if I'm using local storage space on my iOS device when doing so, and if so, is there a way to clear space as needed?