tags:

views:

72

answers:

4

I am not very good with sqls and I am trying to understand an sql statement which I haven't seen before. We're using Oracle and the IBatis framework so this might be specific to one of those. I am not really sure.

SELECT 
....
,....
,....
, PKG_LABEL.GET_LABEL_NAME('UOM',T100.CASE_DIM_UOM_CODE) AS caseDimensionsUOM
, PKG_LABEL.GET_LABEL_NAME('UOM',T100.ITEM_DIM_UOM_CODE) AS itemDimensionsUOM
, PKG_LABEL.GET_LABEL_NAME('UOM',T100.CASE_WEIGHT_UOM_CODE) AS caseWeightUOM
, PKG_LABEL.GET_LABEL_NAME('UOM',T100.PALLET_WEIGHT_UOM_CODE) AS unitNetWeightUOM

FROM 

[..snipped..]

At first glance I thought the PKG_LABEL was merely a table alias but it seems that it is calling a function. I haven't had much experience with stored procedures so I am wondering if it is one.

I would have looked this up in Google but I don't know what it exactly is so I don't know what search term to use.

A brief explanation and some links will be okay.

+2  A: 

PKG_LABEL probably refers to a package.

Thats the oracle name for a group of (related) functions/procedures.

siukurnin
+2  A: 

Look in your schema a try to find a package names PKG_LABEL.

In its body, you should find a function named GET_LABEL_NAME , take a look at its code to know what it does...

vc 74
+2  A: 

PKG_LABEL is a PL/SQL package, which is a collection of PL/SQL functions and procedures. GET_LABEL_NAME is a function within that package, which will perform some logic on its arguments and return a value (probably a character string in this case).

Tony Andrews
+1 for giving links
Jeune
+2  A: 

I don't know much about iBatis, but PKG_LABEL here could be a 'package' in the database. To see if a package with that name exists, you can run this query

SELECT * FROM user_objects
    WHERE    object_type = 'PACKAGE' AND object_name = 'PKG_LABEL';

You can get to know about packages here

johnbk
I chose your answer because you gave me a way to verify if the package exists. Thanks :)
Jeune
Are packages an Oracle feature or is it a standard for relational databases?
Jeune
Packages are specific to Oracle and are a convenient way of grouping together related stored procedures and functions.
John Pickup
You said that it COULD be a 'package' in a database. If it's not package then what could it be?
Jeune
@Jeune - As I said, i have no idea about iBATIS, so thought it 'could' be something related to it..if it is not a PACKAGE.
johnbk
@Jeune, only SELECT object_type FROM user_objects WHERE object_name = 'PKG_LABEL'; will tell you
vc 74