Thursday, 18 November 2010

Advert: SAGE Computing Services Training - Apex 4.0 Workshops

SAGE Computing Services are featuring two training workshops early next month, not long after the AUSOUG conference.

December 6th - Oracle Application Express 4.0 New Features Workshop
This 
course is designed to familiarize current Application Express developers with the exciting new features in Apex 4.0. Topics will include the changes in the interface, new client events, tabular form enhancements, web sheets and team development.

December 8th - 10th - Application Express 4.0 Workshop
If you're looking to get involved with 
Apex, this course provide you with the skills and knowledge required to develop a complete application with the latest release of Oracle’s Application Express 4.0 product. You will develop web interfaces including forms, reports and charts, add validation and customise the formatting to create a small application.

Visit our training web page for more information about our extensive course catalogue. Follow through to the contact us details page. We look forward to hearing from you soon.

Scott Wesley & the team at SAGE Computing Services.
I'm sure Penny, Eddie, Kate, Chris, Branka, Kylie & Ray would like you all to enjoy summer (or winter/wet/dry), and have a great new year!


Final days before the 2010 AUSOUG conference

This blog has been a little neglected as I've been a busy little bee recently, mainly fretting about getting my presentation completed for next week's Australian Oracle User Group Conference - AUSOUG 2020. I have plenty of ideas lined up for post topics, so I should be more active come the next few weeks.

As for the conference, SAGE Computing Services (my employer) will have an exhibition booth, so why don't you come by and say hello to our team. We will have a few things to give away plus some prizes to win - but make sure you bring your thinking caps because we're going to make you work for them!

I'll be joining the rest of the user group committee in Burswood on Sunday night just to make sure everything is good to go - including perhaps that I did the right thing setting up for a wide-screen projector. We should have a good turn out, although humbling in comparison to some of the overseas gigs, I hear.

Some of us are scheduled to present:
  • Penny Cookson - Meet the CBO in Version 11g
    • 11:30am 22nd Nov 2010
  • Scott Wesley - 'n' methods to improve Apex performance
    • 3:15pm 22nd Nov 2010
  • Ray Tindall - Active Directory Integration - AD, WLS & ADF in Harmony
    • 9:45pm 23rd Nov 2010
  • Chris Muir - A change is as good as a REST: JDeveloper 11g's REST web services
    • 11:00am 23rd Nov 2010
  • Penny Cookson - A Path to the Future for Dinosaur Nerds: JDeveloper ADF - A Mind Map for Forms Developers
    • 3:45pm 23rd Nov 2010
The conference program can be subject to change, so check on the day to ensure you don't miss out!

So unless the schedule's changed on me, I'll probably be at the following sessions:

  • Steven Feuerstein - Golden Rules for Developers
  • Penny Cookson - Meet the CBO in Version 11g
  • Howard Ong - Make your legacy application live forever
  • Scott Wesley (won't want to miss this one!) - Apex Performance
  • Jeff Kemp - Oracle Apex Themes and Templates
    • (but sorry Jeff, I may find myself at Mogens Nørgaard - Oracle Licencing)
  • Damien Bootsma - Database performance made easy
  • Tom Kyte - The Best Way
  • Stuart Long Keynote - Cloud Services Automation (CSA)
  • Guy Harrison Keynote - Technology trends impacting Oracle professionals
  • Connor McDonald - Managing optimiser statistics
  • Frank Bommarito - Outlines, Profiles, SQL Plan Baselines

Yes, my selection is very much weighted towards Oracle performance this year. Nothing wrong with having a theme...

Please do come by our booth if you are also after training information, we train around Australia all year round and cover a wide range of Oracle topics. We can also customise the content to suit your organisation - talk to us to find out more. If you can make it to the conference, contact us on-line.

For you conference goers, if I don't see you anywhere amongst all of that, no doubt we'll all be with a beer at the welcome reception from 5pm (oh, I'll be at the AUSOUG AGM first - save me some beer)

Speakers, committee members, exhibitors et al. - listen out for details regarding dinner on Tuesday night, it's always a great night. I may be there... but it's my & Tracey's first wedding anniversary that day ;-)

ScottWe




Friday, 5 November 2010

Quoting inside literal strings

Well some of you may have noticed my slight boo-boo yesterday. I had made some notes on a blog post I planned to finish later, and accidentally published instead of just saving to continue later - so here's my second attempt ;-)

What I found funny, was the post was about exactly what Steven Feuerstein implemented for yesterdays (4/11/2010) PL/SQL Challenge - embedding quotes in literals.

I was reminded of it recently while searching for something - I can't remember what for, but I came across this forum entry: http://database.itags.org/oracle/81577/

I used what I thought an interesting method for adding single quotes to strings - interesting I suppose because I've never used this method before:
EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT=' || chr(39)||'DD.MM.YYYY'||chr(39);

The single row function CHR() will return the character equivalent to the numeric passed, in my case the ASCII character for single quotes. I the past I've mainly used CHR to provide my line feeds and carriage returns. (chr(10 & chr(13) respectively)

The author used this method because inserting a single quote in a normal string means you need to escape it, and this sometimes looks ugly or difficult to interpret:
EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_DATE_FORMAT='''DD.MM.YYYY''';

Oracle 10g introduced a method often called q-quote notation, further information can be found in the SQL Reference documentation here.

This format basically allows you to type the string as you would normally expect to see it, so the following example would display everything between the brackets [ ]
q'[ this isn't my string, is it? ]'

Which would mean our previous example would look like:
EXECUTE IMMEDIATE q'[ALTER SESSION SET NLS_DATE_FORMAT='DD.MM.YYYY']';

Of course, as the documentation describes, you don't need to use those particular brackets. For a while I thought the brackets had to be curly { }, which was frustrating because it became annoying to type. Until recently, I wasn't aware you could go beyond any form of brackets and use any character - as long as it matched up. Lucky, considering yesterday's PL/SQL Challenge did just that!

I found it uncanny, since the list of examples I had lined up for this post was very similar to Steven's list - these will all produce the same result - Hello Scott's computer:

select 'Hello Scott''s computer' hello from dual; 

select 'Hello Scott'||chr(39)||'s computer' hello from dual; 

select q'[Hello Scott's computer]' hello from dual;
select q'{Hello Scott's computer}' hello from dual;
select q'<Hello Scott's computer>' hello from dual;
select q'(Hello Scott's computer)' hello from dual;
select q'"Hello Scott's computer"' hello from dual;
select q'sHello Scott's computers' hello from dual;

So I would suggest choose a combination of brackets that makes sense to you - probably not the last example since it's not that intuitive.

Someone asked me what the point of this particular notation was. I've found it very handy in the past for a number of reasons, but it probably still depends on what your brain is used to seeing (I'm still quite happy using DECODE over CASE, for instance)

For example, when it comes to replacing quotes with double quotes, an exercise I did for something long ago, I can either write it as this complicated list of quotes:
with mine as (select q'[Hello Scott's computer]' hello from dual)
select replace(hello, '''', '"') from mine;

Or make it a little more elegant. This is still probably a weak example, but I've seen a horrible list of quotes in my time that took a while for me to count and realise what was doing what.
with mine as (select q'[Hello Scott's computer]' hello from dual)
select replace(hello, q'[']', '"') from mine;


And then there is the case of large dynamic SQL. It truly is horrible to have to apply two single quotes every time a quote is required, particularly when you're conditionally concatenating certain clauses; and want to just copy and paste the query directly in your GUI to test without replacing all the quotes again.
Here is a basic example of how a small bit of dynamic SQL could become much more readable with the q-quote notation:
declare
  my_string varchar2(100);
begin
  execute immediate q'(select dummy from dual where dummy = 'X')'
  into my_string;
end;
/

I think this PL/SQL challenge has turned out to be a great boon for Oracle developers worldwide. You may be quite a proficient PL/SQL programmer, but not everyone has had the opportunity for exposure to all facets of the database, and people are reporting how wonderful it is to pick up these tips and tricks - in the arsenal ready for future use.

Monday, 1 November 2010

Attention Students! (AUSOUG plug)

Are you a student interested in where the Oracle industry is heading? Are you keen on meeting key figures in the Perth & Australian community? Do you want to be a few steps ahead of your fellow graduates?

These are the questions I remember thinking about as I was studying. There were a number of options out there, and sometimes it's hard to sift through the options to find those of value.

I think the Australian Oracle User Group (AUSOUG) is one of the valuable options, and this year the committee has organised an even better value deal.

The 2010 AUSOUG Perth Conference is just around the corner, and we've brokered a deal to benefit the grass roots of our industry - students!

For $150 tax deductible dollars, you receive membership to the user group AND registration for the two day conference. 

If you happen to be a member already, it's only $100. Membership is normally $65, and student conference registration is normally $320.

I'll let the user group brochure spruik it's benefits, and you can find a link to the conference brochure at the SAGE website - it's worth it, even just listening to the great presentations to be found in the program.

If you're doing a degree like Computer Science or Software Engineering, students of Edith Cowan University, Murdoch University, University of WA, Central Institute of Technology (TAFE), (and any others beyond the major players) contact membership@ausoug.org.au for enquires, or contact Ailsa, our WA President.

ScottWe.

Monday, 18 October 2010

SAGE Computing Services welcomes Kylie Payne

While I was in wonderful Kong Kong, the mugshot arrived and I now have the content to announce Kylie Payne has arrived on our SAGE team:

http://sagecomputing.com.au/about_sage_computing_services.html#kylie

I've already had the opportunity to work with Kylie on a few things and I enjoy her great attitude. We have a similar background - working on a few data integration projects; and now we look forward to the growing world of Oracle Application Express.

To meet Kylie come by our booth at November's AUSOUG conference.

See you there!

ScottWe

Friday, 8 October 2010

Compute the area of...

Riddle me this
Somewhere in the world there must be an exam or test that asks the question to compute the area of a given shape using PL/SQL. I know this because occasionally I look at the Google Analytics for my blog and see some pretty crazy google searches that arrive at my page because of my chosen blog name.

In just a few hours I take off for Hong Kong to take the kids to Disneyland and visit the city for a few days. I'm happy, so (while I don't condone the use of the Internet to solve all your problems) I thought I'd make a few other people happy, and make the visit to my site worthwhile :-)

I've used formulas according to Maths is Fun, and also demonstrated a few other SQL rounding functions you can find well documented here. That's right kids, documentation is your friend.

declare
  lc_pi constant number := 3.141592;
  
  -- triangle
  ln_t_base    number default 2;
  ln_t_height  number default 4;
  
  -- square
  ln_s_length  number default 5;
  
  -- circle
  ln_c_radius  number default 200;
  
  -- ellipse
  ln_e_width   number default 3;
  ln_e_height  number default 2;
  
  -- trapezoid / trapezium
  ln_z_a       number default 2;
  ln_z_b       number default 5;
  ln_z_height  number default 3;
  
  -- sector
  ln_r_radius  number default 4;
  ln_r_degrees number default 45;
  
  ln_area  number;

begin
  -- triangle
  ln_area := 0.5 * ln_t_base * ln_t_height;
  dbms_output.put_line('Triangle: '||ln_area);

  -- square
  ln_area := POWER(ln_s_length, 2);
  dbms_output.put_line('Square: '||ln_area);

  -- circle
  ln_area := lc_pi * POWER(ln_c_radius, 2);
  dbms_output.put_line('Circle: '||ROUND(ln_area, -2));

  -- ellipse
  ln_area := lc_pi * ln_e_width * ln_e_height;
  dbms_output.put_line('Ellipse: '||FLOOR(ln_area));

  -- trapezium
  ln_area := 0.5 * (ln_z_a + ln_z_b) * ln_z_height;
  dbms_output.put_line('Trapezoid: '||CEIL(ln_area));
  
  -- sector
  ln_area := 1/2 * ln_r_radius**2 * ln_r_degrees / 180 / lc_pi;
  dbms_output.put_line('Sector: '||ROUND(ln_area, 5));
  

end simple_calcs;
/  

Triangle: 4
Square: 25
Circle: 125700
Ellipse: 18
Trapezoid: 11
Sector: 6.28319

PL/SQL procedure successfully completed.

See you on the other side of Hong Kong!

Thursday, 7 October 2010

Perth AUSOUG Conference Information 2010 (advert)


To all Oracle, E-Business Suite; J2EE; DBA; Enterprise Architects; Siebel Users; MIS Management; and Academia professionals interested in this years Australian Oracle User Group conference in Perth (and why wouldn't you be?), I've just published some information on our SAGE website.

Here is a page linking to an amazing brochure that details everything you need to know about the conference.

And here I detail times where you can catch our SAGE experts present; and also link to our past presentations.

Download the daily session program for more information.

There really is a great line-up this year, and as usual I look forward to catching up with local & international guests.

ScottWe.