Package getPackageCallContext() {
    Scope cur = exec.currentScope;
    while (cur != null) {
      if (cur.type == Scope.Type.ROUTINE) {
        return cur.pack;
      }
      cur = cur.parent;
    }    
    return null;
  }
Get the package context within which the current routine is executed
hplsql/src/main/java/org/apache/hive/hplsql/Exec.java