i keep getting error
SP2-0552: BIND VARIABLE "PVUSAGEDATE" NOT DECLARED.
im confuse on why it only gives me a error on the usage date but not the other ones, or maybe there is a better way to run it.
It could be because the other bind variables are declared correctly, but pvusagedate isn't.
Or it could be that they are all invalid, but the parser happens to look at pvusagedate first, sees that it's not defined, raises the error and stops work on that query.
No kidding; you need to start posing complete test scripts so that the people who want to help you can re-create the problem and test their ideas. The error is probably not in the code you posted. Don't repeat the same mistakes over and over.
See the forum FAQ:
and your previous messages
You need to declare and populate your bind variables. (you can't have a date bind variable type in sql plus, so you need to do a to_date for the character string).
SQL> var PvProperty number
SQL> var pvUnitTypeID number
SQL> var pvUsageDate varchar2(30)
2 :PvProperty := 123;
3 :pvUnitTypeID := 456;
4 :pvUsageDate := '08-OCT-2013';
6 dbms_output.put_line (:PvProperty);
7 dbms_output.put_line (:pvUnitTypeID);
8 dbms_output.put_line (:pvUsageDate);
PL/SQL procedure successfully completed.
First you need a SQL*Plus command, SET SERVEROUT ON
Then put the DBMS_OUTPUT as a sqlPlus statement of its own in the procedure. Since most of your procedure is a single statement, in what you posted, it can only go immediately after the BEGIN or immediately before the END.
SELECT Main.SEGMENT_CODE, ...
dbms_output.put_line ('Rows selected: ' || SQL%ROWCOUNT);
Re: the original question, "im confuse on why it only gives me a error on the usage date but not the other ones, or maybe there is a better way to run it."
SQL will only give you one error per statement. It stops processing once it finds an error. Which error it reports is not officially defined. Often it complains about the problems at the end of the statement when there are similar problems earlier in the statement. This is quite different from the behaviours of many programming language compilers.
So if a SQL statement reports a syntax error, all you can say is "the statement has syntax errors, including the reported problem." You cannot say "It's OK up to the point the error is reported."
I hope this helps clarify things.