Preventing PL/SQL name clashes. You learn something new every day!

glasses-272399_1280-smallI mentioned in yesterday’s Oracle Midlands post, Bryn had an example of some syntax I had not seen in 20+ years of PL/SQL development.

You tend to name PL/SQL parameters and variables in such a way as to prevent name clashes with table columns, but you could just qualify each use of a PL/SQL identifier with the identifier for the name of the block in which the item is declared in this case the procedure name. In the following example, “dummy” is both a parameter name and a table column, but Oracle knows exactly what you mean because you’ve fully qualified it.

create or replace procedure my_proc(dummy varchar2)
as
  amount pls_integer;
begin
  select count(*)
  into   my_proc.amount
  from   dual a
  where  a.dummy = my_proc.dummy;
  dbms_output.put_line('amount=' || my_proc.amount);
end my_proc;
/

set serveroutput on
exec my_proc('Y');
amount=0

PL/SQL procedure successfully completed.

SQL>

You can also do this for parameterised cursors and named/labelled blocks. You learn something new every day! :)

This was just one of the points Bryn discussed in his whitepaper called Doing SQL from PL/SQL: Best and Worst Practices.

Bryn: Look for this section: “Name capture, fine grained dependency tracking, and defensive programming”. This discussion leads to this:

Principle 1: In embedded SQL, dot-qualify each column name with the from list item alias. Dot-qualify each PL/SQL identifier with the name of the name of the block that declares it.

It is also mentioned in his paper Why use PL/SQL?

Cheers

Tim…

Oracle Midlands : Event #12 – Summary

Tonight was Oracle Midlands Event #12 with Bryn Llewellyn  and Neil Chandler.

Bryn very kindly stepped in for Tom Freyer who unfortunately couldn’t make it. Bryn’s presentation was called Why use PL/SQL?, which was based on his whitepaper of the same name. I’ve written about a number of the topics he raised, including a piece on My Utopian Development Environment, but his talk and his whitepaper put forward a much more consistent and compelling argument. Definitely worth checking out if you are a PL/SQL expert or newbie!

Along the way, he used a little piece of syntax I have never noticed before, which has been available for the whole 20+ years I’ve been using PL/SQL. I’ll write about that in a post tomorrow if I get chance.

By the way, Bryn loves being called Brian, and he loves it when you say S.Q.L. and PL/S.Q.L. rather than Sequel and PL/Sequel. :)

redstacktechNext up was Neil with a session called “Why has my plan changed?”. I’ve written about many of the issues discussed in this session, but Neil crystallised a whole array of points really well, and used live demos which I always like to see. Regardless of how well you think you know the subject, I would be surprised if you don’t walk away with a few new things, which you can later pretend you always knew. :)

Both guys will be presenting these sessions at UKOUG Tech15 if you want to catch up with them!

Thanks to the guys for coming to speak to us. Thanks to Bryn’s mom, for living in the UK, giving him an excuse to come to UKOUG Tech15 early and therefore be available to step in at short notice. Thanks as always to Red Stack Tech for sponsoring the event, allowing it to remain free, and to Mike for organising it!

Cheers

Tim…

AIOUG Sangam15 : It’s a Wrap!

The whole Sangam15 experience is over for me now!

Here are the posts I put out during the trip.

I did my thank you messages in the Day 2 post, but once again I would like to say a big thank you to AIOUG for inviting me, to the Oracle ACE Program for getting me to the event and to all the attendees for making it a great event and for making my Facebook go nuts! :)

See you all soon!

Cheers

Tim…

AIOUG Sangam15 : The Journey Home

The night before a morning flight is always a little tricky for me. I lie in bed thinking, “What if I oversleep?”, which winds me up and makes it really hard to relax and drop off. I dozed on and off, but eventually gave up, turned the TV on and watched some films for a few hours.

I grabbed a quick breakfast and got the taxi to the airport. The hotel staff advised leaving at 07:00 for a 10:15 flight. The traffic was very light and the queues for check-in and security very small, so I ended up sitting at the boarding gate two hours before the flight. Better to be early than late!

Hyderabad airport is very clean, modern and has some reclining seats so I was able to chill out for a while. :)

The flight from Hyderabad to Dubai took about 3.5 hours. It was relatively uneventful, but rather uncomfortable. I had an aisle seat, but the guy in the centre decided he wanted to sit with his elbows digging into my ribs and his leg pressed against mine. I wouldn’t mind so much if he was a big guy and couldn’t help it, but he was a skinny little thing, so taking all of his space and part of mine seemed unnecessary. :)

As soon as we landed in Dubai airport, I grabbed some food and headed off for the boarding gate. Very soon we were on the plane and heading to Birmingham. I enquired about an upgrade, but it was going to cost $2,500 USD, so that wasn’t going to happen. :)

I got to experience wifi on the plane for the first time. It’s been “available” on other flights, but I’ve never got it to work before. I got it working on the flight between Dubai and Birmingham. It was ultra-slow, but better than nothing and only $1. :) It made the 7 hour flight go a lot quicker.

I arrived back in Birmingham safe and sound. After a quick taxi ride home I put my washing on, scrubbed the smell of aeroplane off me and went to bed!

Cheers

Tim…

AIOUG Sangam15 : Day 2

My session on Day 2 started at 11:10, where I spoke about running Oracle Databases in the Cloud. This included a quick run through of the Oracle DBaaS offering and AWS RDS for Oracle amongst other things.

The session generated a lot of interest. In fact, I spent the next 5 hours answering questions and taking photos with people. It sounds kind-of crazy, but it was really good fun. As a result, I didn’t get to see any sessions, but as I said yesterday, I feel my purpose here is to connect with people and that is exactly what I did for 5 hours straight. Thanks to everyone that came to speak to me. You made me feel very special and I hope I was able to help you. It never ceases to amaze me what an impact one little website can have!

From there it was on to the closing talks. In addition to the normal closing speeches, there was a motivational talk by DR Rajdeep Manwani. I really enjoyed the talk and judging by the reaction of the crowd, so did everyone else. The talk used several anecdotes and his personal experiences to put across the message that your success or failure is your responsibility. You can blame others when things go wrong (external locus of control) or take personal responsibility (internal locus of control). Ultimately, successful people are those that take personal responsibility and do something about it, rather than blame the world for their failings. I wholeheartedly agree.

After that I spent some time saying my goodbyes, then it was off to get some food and then to bed, ready for my early start for the trip home.

I would like to say a big thank you to the AIOUG for inviting me and to all the AIOUG volunteers that made the event go so well. Thanks also to the Oracle ACE Program for getting me to the event. My special thanks go to all the attendees that made me feel really special for two days.

Tomorrow is the journey home. Fingers crossed for free upgrades to Emirates business class! :)

Cheers

Tim…

AIOUG Sangam15 : Day 1

I was up at about 04:00 on Saturday and waiting for breakfast to open at 06:30. Pretty much as soon as I ate something I felt really tired again. That after a day of sleeping… :)

I headed on down to the conference and instantly saw a bunch of friendly faces, including lots of people I had met on the OTN Yathra 2014 Tour.

After the keynotes, I got to have a quick chat about User Groups with Mary Lou Dopart from Oracle, then it was off to my first session about database consolidation.

I’m always more nervous about giving introductory/overview sessions than I am about full-on technical sessions. My database consolidation session is a little bit like a history lesson of consolidation, including old and new. The response was very good. I had a lot of people wanting to speak to me afterward, which meant I missed the next two sessions. I don’t mind that, as I feel my purpose here is to interact with as many people as possible. As long as people want to speak to me I’m willing to speak. :)

After lunch I had a major energy crash again. Whenever I was speaking to people I felt really up-beat, but as soon as the conversation stopped I felt like I wanted to collapse on the floor and sleep. To play it safe I went back to my room to sleep for a couple of hours.

Next up I went to see Debaditya Chatterjee and Giridhar Ravipati speaking about “Oracle Multitenant Best Practices”. Some points that came out of that were.

  • Always use the AL32UTF8 character set for the CDB. Most other character sets can be converted to that to allow them to become PDBs and in a future version, we might be able to plug in a PDB with any character set, provided it is a subset of the CDB character set.
  • Use OMF, as it simplifies file management substantially.
  • Consider the impact of operations, like patching. Are you patching all PDBs, or not? If not, you will be using the unplug/plug approach to patching.
  • Standardise as much as possible.
  • Size SGA, redo and undo correctly to allow for the combined needs of the consolidated workload.
  • Always use Resource Manager to control resource usage of each PDB.
  • Don’t modify PDB$SEED. Create a new PDB with the modifications, then use that as the clone source, for new PDBs, instead of the seed.
  • Stagger maintenance windows within a CDB so all PDBs aren’t doing maintenance tasks at the same time.

Some points about possible features in 12.2 were also mentioned, including:

  • Maximum number of PDBs increased from 252 to 4096.
  • PDB memory management via resource manager.
  • Ability to set CPU_COUNT at the PDB level to allow the equivalent of instance caging for the PDB.
  • Hot cloning of PDBs and incremental PDB refresh.
  • Application containers, to allow common definitions across all similar PDBs. Useful for ISVs who require many copies of the same PDB, like one for each customer.
  • Online relocate of PDB from on-premise to cloud, as demoed by Larry Ellison at OpenWorld 2015

Remember, all talk of 12.2 is covered by the safe harbour slide, so those features might not end up in the final release. :)

After speaking to Debaditya and Giridhar, we headed off to a panel session to close the day. As most people will know, putting me on a panel can be a dangerous thing. I ended up having something to say about almost everything. Panels are a mix of scary and fun. :) As usual, the session was followed by additional questions and conversations which lasted about an hour. :)

After saying a few quick goodbyes, it was off to grab some food, then back to my room to sleep some more. Are you starting to sense a pattern here? :)

Overall, day 1 was a really fun experience. Let’s hope day 2 does not come with quite so much jet-lag! :)

Cheers

Tim…

AIOUG Sangam15 : The Journey Begins

The day started pretty early. I was packing at 00:00 and the alarm went off at 05:00. Nothing like last minute packing to focus the mind. :)

The taxi to the airport was good. The driver was interesting, speaking to me about his visits to India and Pakistan. It certainly helps pass the time when the driver is chatty.

I wasn’t able to check-in online, but there was no queue at the check-in desk, so that was quick. It’s such a short trip I’m only traveling with hand luggage, but I still checked it. I can’t be bothered to fight for overhead locker space with everyone. The queue for security was really long, but they had all the sections open, so it moved quickly. I had to get my laptop scanned because … reasons?

Once through security I bought myself a coffee and promptly threw it across the floor. Embarrassing much! I was hoping to find some floor to take a nap on, but after shaming myself with the coffee situation, I thought the last thing I needed was to shame myself further by sleeping on the floor. I try to limit myself to one shameful moment per airport visit…

The flight from Birmingham to Dubai was easy. It was meant to be 6.5 hours, but we arrived early. The plane was half empty, so there was free space next to me. Happy days. During the flight I watched:

After a 2.5 hour layover in Dubai, it was time for the next flight. The flight from Dubai to Hyderabad was really busy and some lucky people, including me, got upgrades to business class (see video). It was only a 3 hour flight, but I’m all about the business class these days! :) The important thing about upgrades is you have to pretend it wasn’t a free upgrade and you could afford it. :) During the flight I watched the second half of Mission Impossible : Rogue Nation. It was quite good.

After a very pleasant flight, I arrived at Hyderabad and bumped into Kamran Agayev at customs. We agreed to share a taxi to the hotel, then I made him wait for over an hour for my bag to arrive. It was really embarrassing. Sorry mate!

I’m now firmly ensconced in the hotel (see video). It’s 05:24 and I plan to spend the whole of today (Friday) in bed playing catch-up, before the conference starts on Saturday.

Cheers

Tim…

Oracle Midlands : Event #12

Just a quick reminder, Oracle Midlands Event #12 is just around the corner.

Update: The first talk is now “Why use PL/SQL?” by Bryn Llewellyn.

This is the day after I get back from India, right after my first day back at work. It’s going to be really hard to drag myself there, but I know it will be worth it!

Cheers

Tim…

 

 

 

SANGAM15 : It’s nearly here!

In about a week I will be starting my journey to Hyderabad to speak at SANGAM15, the big AIOUG event for India.

I’ve been to India before, when I did the Yathra tour, but this is my first SANGAM event, so I don’t really know what to expect. :)

The plan is:

  • 7 hour flight to Dubai.
  • 2.5 hour layover.
  • 3.5 hour flight to Hyderabad.
  • 2 days in the conference.
  • 4 hour flight to Dubai
  • 2 hour layover.
  • 8 hour flight home.

It’s going to be my last foreign trip this year and it’s going to be a hectic one. :)

If you see me at the conference, please come and speak to me. I love talking about geeky Oracle stuff, so you won’t be disturbing me. :)

Cheers

Tim…

VirtualBox 5.0.10

VirtualBox 5.0.10 has been born.

Downloads and changelog in the usual places.

There has been a bit of a discussion on Twitter today about the pros and cons of upgrading VirtualBox. I run VirtualBox on Windows 7 at work and Linux and Mac at home. Unless I’m travelling, I pretty much upgrade straight away. In recent history I only remember one time a patch has caused me problems and forced me to back it out. It seems other people on Twitter have had more issues than me.

I made the jump from VirtualBox 4 to 5 immediately and haven’t suffered at all.

If you are having issues, VirtualBox has a public bugtracker where you should log your problems. If you don’t tell them about your problems, they can only assume you aren’t having them. :)

Cheers

Tim…