1

手順:

FUNCTION f_exists (
  p_pidm                      gobansr.gobansr_pidm%TYPE,
  p_num                       gobansr.gobansr_num%TYPE,
  p_rowid                     gb_common.internal_record_id_type DEFAULT NULL)
RETURN VARCHAR2 IS
--
  TYPE queryone_ref IS REF CURSOR;
  lv_cursor queryone_ref;
  lv_tempout VARCHAR2(1) := 'N';
BEGIN
--
-- Assign the cursor variable to the appropriate cursor
--
  IF p_rowid IS NOT NULL THEN
    OPEN lv_cursor for
    SELECT 'Y'
      FROM gobansr
     WHERE ROWID = p_rowid;
  ELSE
    OPEN lv_cursor for
    SELECT 'Y'
      FROM gobansr
     WHERE gobansr_pidm = p_pidm
       AND gobansr_num = p_num;
  END IF;
  FETCH lv_cursor INTO lv_tempout;
  CLOSE lv_cursor;
  RETURN lv_tempout;
END f_exists;

ストアド プロシージャを実行/クエリするための PHP コード:

$conn = oci_connect($username, $password, $db);
$sql = 'BEGIN "gb_pin_answer"."f_exists"(:p_pidm, :p_num); END;';
$stmt = oci_parse($conn, $sql);

if (!$conn)
  exit("DB did not connect.");

$p_pidm = 36706;
$p_num = 1;

oci_bind_by_name($stmt,':p_pidm',$p_pidm,5);
oci_bind_by_name($stmt,':p_num',$p_num,1);

if (!oci_execute($stmt))
  exit("Procedure Failed.");

oci_commit($conn);
oci_close($conn);

ストアド プロシージャに対する実行権限があり、PHP がデータベース サーバーに正常に接続されていることを DBA に確認しました。

次のエラーが返されます。

メッセージ: oci_execute(): ORA-06550: 行 1、列 8: PLS-00201: 識別子 'gb_pin_answer.f_exists' を宣言する必要があります ORA-06550: 行 1、列 8: PL/SQL: ステートメントは無視されました

アップデート:

私は実行できました:select gb_pin_answer.f_exists('36706','2') as RESULT from dualそしてそれはYを返しました

ここで、php でこのストアド プロシージャを使用する方法を理解する必要があります。

PROCEDURE p_create(
  p_pidm                      gobansr.gobansr_pidm%TYPE,
  p_num                       gobansr.gobansr_num%TYPE,
  p_gobqstn_id                gobansr.gobansr_gobqstn_id%TYPE DEFAULT NULL,
  p_qstn_desc                 gobansr.gobansr_qstn_desc%TYPE DEFAULT NULL,
  p_ansr_desc                 gobansr.gobansr_ansr_desc%TYPE,
  p_ansr_salt                 gobansr.gobansr_ansr_salt%TYPE,
  p_user_id                   gobansr.gobansr_user_id%TYPE DEFAULT gb_common.f_sct_user,
  p_data_origin               gobansr.gobansr_data_origin%TYPE,
  p_rowid_out             OUT gb_common.internal_record_id_type) IS
--
  lv_gobansr_rec    gobansr%ROWTYPE;
  error_message     gb_common_strings.err_type;

  lv_hashed_answer  gobansr.gobansr_ansr_Desc%type;
  lv_salt           gobansr.gobansr_ansr_salt%type;
BEGIN
--
-- Make sure the record doesn't already exist
--
  IF (gb_pin_answer.f_exists(p_pidm,p_num)='Y') THEN
    error_message :=  gb_common_strings.f_append_error(error_message,
                        gb_pin_answer_strings.f_get_error('RECORD_EXISTS'));
  END IF;
--
  IF (error_message IS NOT NULL) THEN
    RAISE_APPLICATION_ERROR(gb_common_strings.ERR_CODE, error_message);
  END IF;

  lv_salt := gspcrpt.F_GET_SALT(length(replace(p_ansr_desc,' ')));
  gspcrpt.p_saltedhash(lower(replace(p_ansr_desc,' ')),lv_salt,lv_hashed_answer);

--
-- Execute business rules
--
  gb_pin_answer_rules.p_validate(
    p_pidm               => p_pidm,
    p_num                => p_num,
    p_gobqstn_id         => p_gobqstn_id,
    p_qstn_desc          => p_qstn_desc,
    p_ansr_desc          => p_ansr_desc,
    p_ansr_salt          => lv_salt,
    p_user_id            => p_user_id,
    p_data_origin        => p_data_origin);
--
-- This is where the local user exit call, if defined, will occur.
--
  /* -- No local call
    p_pidm                     => p_pidm,
    p_num                      => p_num,
    p_gobqstn_id               => p_gobqstn_id,
    p_qstn_desc                => p_qstn_desc,
    p_ansr_desc                => p_ansr_desc,
    p_ansr_salt                => lv_salt,
    p_user_id                  => p_user_id,
    p_data_origin              => p_data_origin);
*/
--
-- Build the DML record
--
  lv_gobansr_rec := f_build_gobansr_rec(
    p_pidm               => p_pidm,
    p_num                => p_num,
    p_gobqstn_id         => p_gobqstn_id,
    p_qstn_desc          => p_qstn_desc,
    p_ansr_desc          => lv_hashed_answer,
    p_ansr_salt          => lv_salt,
    p_user_id            => p_user_id,
    p_data_origin        => p_data_origin);
--
-- Set the activity date
--
  lv_gobansr_rec.gobansr_activity_date := SYSDATE;
--
-- Delegate to the DML layer
--

  dml_gobansr.p_insert(lv_gobansr_rec, p_rowid_out);
--
-- NOTE:  Banner Messaging Support logic is only called after a
--        successful DML operation
-- Check if messaging is enabled/licensed for this business entity.
--
  IF (gb_event.f_entity_publishable(gb_event.baseline_ind,
                                        M_ENTITY_NAME)) THEN
--    Register this business entity with messaging support.
    gb_pin_answer_rules.p_register_entity(
      p_operation_type     => gb_event.CREATE_OPERATION,
      p_pidm               => p_pidm,
      p_num                => p_num,
      p_gobqstn_id         => p_gobqstn_id,
      p_qstn_desc          => p_qstn_desc,
      p_ansr_desc          => p_ansr_desc,
      p_ansr_salt          => p_ansr_salt,
      p_user_id            => p_user_id,
      p_data_origin        => p_data_origin,
      p_internal_record_id => p_rowid_out);
  END IF;
END p_create;
4

1 に答える 1