Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    1,074

    Unanswered: Using functions and db links

    I got a function to work via a dblink, but when I tried one with a parm, it fails. Can someone help me with the appropriate syntax?

    Code:
    SQL> connect forbesc@test
    Enter password: *******
    Connected.
    SQL> create or replace function f_chuck return varchar2
      2  is
      3  begin
      4    return 'no parm';
      5  end;
      6  /
    
    Function created.
    
    SQL> begin
      2    dbms_output.put_line(f_chuck);
      3  end;
      4  /
    no parm
    
    PL/SQL procedure successfully completed.
    
    SQL> create or replace function f_chuck2 (p_varchar varchar2) return varchar2
      2  is
      3  begin
      4    return p_varchar;
      5  end;
      6  /
    
    Function created.
    
    SQL> begin
      2    dbms_output.put_line(f_chuck2('with parm'));
      3  end;
      4  /
    with parm
    
    PL/SQL procedure successfully completed.
    
    SQL> connect forbesc@dev
    Enter password: *******
    Connected.
    SQL> set serveroutput on
    SQL> begin
      2    dbms_output.put_line(f_chuck@test);
      3  end;
      4  /
    no parm
    
    PL/SQL procedure successfully completed.
    
    SQL> begin
      2    dbms_output.put_line(f_chuck2('with parm')@test);
      3  end;
      4  /
      dbms_output.put_line(f_chuck2('with parm')@test);
                                                *
    ERROR at line 2:
    ORA-06550: line 2, column 45:
    PLS-00103: Encountered the symbol "@" when expecting one of the following:
    . ( ) , * % & | = - + < / > at in is mod remainder not range
    rem => .. <an exponent (**)> <> or != or ~= >= <= <> and or
    like as between from using || multiset member SUBMULTISET_
    Thanks,
    Chuck

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Correct syntax is:

    dbms_output.put_line(f_chuck2@test('with parm'))

  3. #3
    Join Date
    Dec 2003
    Posts
    1,074
    I should be flogged for not even trying that alternative before posting.
    Thanks andrewst,
    -cf

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •