I am using this oracle connection code in sas and getting this error:
ORACLE prepare error: ORA-06553: PLS-306: wrong number or types of arguments in call to 'get_pat_fix';
my code looks like this:
proc sql;
connect to oracle(user='XXXXX'orapw='XXXXXX'path='');
create table work.XXX as select * from connection to oracle (
select to_char(yy.XXXX) as XXXXXX,
substr(get_pat_fix ('XX', yy.XXXX , 'XX','XX'),1,5) XXXX,
from XXX;
I have tried to modify it several times but could not get it fixed. I would extremely开发者_运维问答 appreciate your help regarding the same.
"I didnt understand the get_pat_fix function explanation."
Browse the function in an IDE like TOAD or SQL Developer, or describe it in SQL*Plus like this:
SQL> desc validate_salary
FUNCTION validate_salary RETURNS VARCHAR2
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
P_CURRENT_SAL NUMBER IN
P_RAISE_PCT NUMBER IN
P_JOB VARCHAR2 IN
P_HIREDATE DATE IN
P_DEPTNO NUMBER IN DEFAULT
SQL>
This shows you the number and datatype of the parameters. We must pass values for every paramater which doesn't have a default, and we must pass a variable for any OUT or IN OUT parameter. The passed values must match the datatype of the parameter.
Parameters can be passed by position...
SQL> select validate_salary (4000, 10, 'MGR', sysdate-720)
2 from dual
3 /
VALIDATE_SALARY(4000,10,'MGR',SYSDATE-720)
--------------------------------------------------------------
okay
SQL>
... or by named notation...
SQL> select validate_salary (p_current_sal=> e.sal
2 , p_hiredate=> e.hiredate
3 , p_deptno => e.deptno
4 , p_job => e.job
5 , p_raise_pct=> 10 )
6 from emp e
7 /
VALIDATE_SALARY(P_CURRENT_SAL=>E.SAL,P_HIREDATE=>E.HIREDATE,P_DEPTNO=>E.DEPTNO,P
--------------------------------------------------------------------------------
okay
okay
okay
...
Either way, the parameters need to match:
SQL> select validate_salary (4000, 10, 'MGR')
2 from dual
3 /
select validate_salary (4000, 10, 'MGR')
*
ERROR at line 1:
ORA-06553: PLS-306: wrong number or types of arguments in call to
'VALIDATE_SALARY'
SQL> select validate_salary (4000, 'MGR', sysdate-720, 40)
2 from dual
3 /
select validate_salary (4000, 'MGR', sysdate-720, 40)
*
ERROR at line 1:
ORA-06553: PLS-306: wrong number or types of arguments in call to
'VALIDATE_SALARY'
SQL>
Of course, I missed out the most obvious answer: consult your application's documentation, which will have a detailed description of the GET_PAT_FIX() function including its signature. :-D Sorry, thought I could keep a straight face while I typed that.
Alas, in the real world too many of us have to struggle along without decent documentation for our apps. So we have to interrogate the database schema. I don't think there are any SAS tools for doing this (the ones Google throws up all seem to be just data browsers). So that means you'll need a database tool. I'm going to suggest Oracle's SQL Developer not because it's the best (that's a matter of taste) but because it is free, and it works. Find it here.
精彩评论