locked
New to Oracle with a simple select statement RRS feed

  • Question

  • User1643311357 posted

    I am updating an Oracle stored procedure and I want to test parts of this large proc before making the changes.

    I can do the following and get results:

    SELECT * FROM table_name WHERE column_name_in_table = '1234'

    But when this goes to production, the hard coded number will be a variable but when I do the following:

    p_userid char(8 BYTE) := '1234';
    SELECT * FROM table_name WHERE column_name_in_table = trim(p_userid)

    I get an error: ORA-00904: "P_USERID": invalid identifier
    00904. 00000 -  "%s: invalid identifier"

    What is the easiest way to see a select statement results in Oracle?

    Tuesday, August 7, 2012 8:14 AM

Answers

  • User1643311357 posted

    Figured it out...needed the keyword "variable" in front

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 7, 2012 1:28 PM

All replies

  • User346251827 posted

    when defining p_userid try using number or varchar instead of char(8 BYTE)

    Tuesday, August 7, 2012 9:35 AM
  • User1643311357 posted

    Help a guy out here :-)

    So can I take it from the silence that there is not a good way to unit test code before updating a whole procedure or package?  Say it isn't so!

    Tuesday, August 7, 2012 1:19 PM
  • User1643311357 posted

    Figured it out...needed the keyword "variable" in front

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, August 7, 2012 1:28 PM