code: protected boolean isStoredProcedure(String sql)
      {
          /*
          Stored procedures start with
          {?= call <procedure-name>[<arg1>,<arg2>, ...]}
          or
          {call <procedure-name>[<arg1>,<arg2>, ...]}
          but also statements with white space like
          { ?= call <procedure-name>[<arg1>,<arg2>, ...]}
          are possible.
          */
          int k = 0, i = 0;
          char c;
          while(k < 3 && i < sql.length())
          {
              c = sql.charAt(i);
              if(c != ' ')
              {
                  switch (k)
                  {
                      case 0:
                          if(c != '{') return false;
                          break;
                      case 1:
                          if(c != '?' && c != 'c') return false;
                          break;
                      case 2:
                          if(c != '=' && c != 'a') return false;
                          break;
                  }
                  k++;
              }
              i++;
          }
          return true;
      }
docs: Check if the specified sql-string is a stored procedure
  or not.
  @param sql The sql query to check
  @return <em>True</em> if the query is a stored procedure, else <em>false</em> is returned.