Select from dual  into a variable through db links

HI,I need to select value of current_timestamp in to a variable d1 of a remote database inside function.
function (db_lnk varchar2)return number
as
dbl varchar2(10);
begin
dbl:=db_lnk;
select current_timestamp into d1 from dual@dbl;
end;
but getting error table or v iew does not exist.
if i do
select current_timestamp into d1 from dual@'||dbl||';
then it says database link name expected.
How to achieve this?
Thanks

Peter Gjelstrup wrote:
Foreign languages, foreign languages :-){noformat}*grins*{noformat} I know - and your English is miles better than my Danish (I'm assuming - hopefully correctly?! - that that's your 1st language based on your location!) which I don't even know any words of! *{:-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Select LONG column into CLOB variable

    Hi all,
    I am trying retrieve the data present in a LONG column into a CLOB variable.
    However I am getting an error, pls let me know how I can resolve it.
    DECLARE
    v_text CLOB;
    BEGIN
    SELECT TO_LOB(trigger_body)
    INTO v_text
    FROM
    user_triggers
    WHERE
    ROWNUM <= 1;
    END;
    ERROR at line 8:
    ORA-06550: line 8, column 20:
    PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got LONG
    ORA-06550: line 8, column 5:
    PL/SQL: SQL Statement ignored
    Let me know if there is an alternate to this. I would like to get the data present in the LONG column into a variable.
    The reason why I am not retrieving the LONG column into LONG variable is stated below (from Oracle Website):
    You can insert any LONG value into a LONG database column because the maximum width of a LONG column is 2**31 bytes.
    However, you cannot retrieve a value longer than 32760 bytes from a LONG column into a LONG variable.
    Thanks and Regards,
    Somu

    There are couple of things I did (listed in order):
    1) Create Global Temporary Table containing a CLOB column
    2) Select LONG column and convert to CLOB by using TO_LOB and insert into Global Temporary Table containing a CLOB column
    2) Select from this Global Temporary Table (which already contains data in CLOB) and assign it to a CLOB variable.
    This is done because you can not directly use TO_LOB in a select statement to assign the value to a CLOB variable.
    Stated below is an example:
    -- Create Temporary Table
    CREATE GLOBAL TEMPORARY TABLE glb_tmp_table_lob(
    time TIMESTAMP WITH LOCAL TIME ZONE,
    text CLOB
    ON COMMIT DELETE ROWS;
    -- PL/SQL Block to Execute
    DECLARE
    v_clob CLOB;
    BEGIN
    -- Insert into Temporary Table by converting LONG into CLOB
    INSERT INTO glb_tmp_table_lob (
    time ,
    text
    SELECT
    sysdate ,
    TO_LOB(dv.text)
    FROM
    dba_views dv
    WHERE
    ROWNUM <= 1
    -- Select from the Temporary table into the variable
    SELECT
    gt.text
    INTO
    v_clob
    FROM
    glb_tmp_table_lob gt;
    COMMIT;
    -- Now you can use the CLOB variable as per your needs.
    END;
    /

  • How to take output of execute immediate 'select * from table' into a file ?

    hi all,
    below is my code .....
    declare
    var_column_name varchar2(2000);
    main_string varchar2(12000);
    var_table_name varchar2(30);
    base_string varchar2(2000);
    final_string varchar2(2000);
    cursor c1 is
    select
    object_name
    from user_objects
    where object_type in ('TABLE','VIEW') and rownum < 2 ;
    cursor c2 is
    select
    column_name
    from user_tab_columns
    where upper(table_name) = upper(var_table_name);
    begin
    --var_column_name := null;
    -- main_string :=null;
    -- table_name :=null ;
    -- base_string :=null;
    -- final_string := null;
    open c1;
    fetch c1 into var_table_name;
    close c1;
    for c2_var in c2
    loop
    main_string := c2_var.column_name||','||main_string;
    end loop;
    select rtrim(main_string,',') into final_string from dual;
    dbms_output.put_line(final_string);
    base_string := 'Select '||final_string ||' from '||var_table_name||'' ;
    dbms_output.put_line(base_string);
    spool tete.lst;
    execute immediate base_string;
    spool off;
    end;
    i want to take the output of the execute immediate in a file on unix server ....
    please suggest
    rgds
    s

    Were you looking for something like this?
    SELECT
         CASE WHEN Columns.Column_Id = 1 THEN 'SELECT ' || CHR(10) END
              || CHR(09) || Columns.Column_Name
              || CASE
                   WHEN Columns.Column_Id = Info.Total_Columns THEN
                           CHR(10) || 'FROM'
                        || CHR(10) || CHR(09) || Columns.Table_Name || ';'
                        || CHR(10)
                   ELSE ','
                 END          Statement
    FROM
         User_Tab_Columns     Columns,
          SELECT
              Table_Name,
              MAX(Column_Id) Total_Columns
          FROM
              User_Tab_Columns
          GROUP BY
              Table_Name
         )               Info
    WHERE
         Columns.Table_Name = Info.Table_Name
    ORDER BY
         Columns.Table_Name,
         Columns.Column_Id;

  • DB Trigger: select from and into current table

    I'm running 8.0.5 and facing a table looking like MYTAB(RECID,RECLABEL,..., PARENTRECID, PARENTRECLABEL) where:
    . RECID = current record UID (say: employee number)
    . RECLABEL = current record label (say: employee name)
    . PARENTRECID = RECID of another record in table MYTAB (say: employee ID of the manager of the current employee)
    . PARENTRECLABEL = must be made to hold automatically the contents of RECLABEL in the parent record (say: the name of the manager of the current employee)
    I know an easy way to get this info would be to use a view like CREATE VIEW MYVIEW AS SELECT A.RECID, A.RECLABEL, A.PARENTRECID, B.RECLABEL "PARENTRECLABEL" FROM MYTAB A, MYTAB B WHERE A.PARENTRECID=B.RECID but for various reasons I would really love to denormalize that info into column PARENTRECLABEL using a database trigger.
    Obviously, table MYTAB itself cannot be selected from during the execution of the dB trigger: mutating table error !
    I tried:
    . to select from a view defined as "SELECT * FROM MYTAB" as suggested in another thread, but this trick didn't seem to be sufficient to lure Oracle (it still says I'm trying to select from a mutating table !)
    . to use a package within which a PL/SQL table variable is filled with the list of affected RECID on a FOR EACH ROW basis, and to issue updates in a after statement (thus: not AFTER EACH ROW) AFTER UPDATE trigger - but it's too late already and those updates are apparently not taken into account by the database.
    Any other suggestions?
    Thx - Didier

    Here's the code, if the formatting in unpreserved please do let me I'll mail the same.
    The Package
    CREATE OR REPLACE PACKAGE save_table_package
    AS
    TYPE saved_test2_type
    IS TABLE OF test2%ROWTYPE
    INDEX BY BINARY_INTEGER;
    saved_test2 saved_test2_type;
    saved_test2_num NUMBER:= 1;
    PROCEDURE save_test2_row(i_id NUMBER
    ,i_ename VARCHAR2
    ,i_mgr_id NUMBER
    ,i_mgr_ename VARCHAR2
    PROCEDURE clear_rows;
    END save_table_package;
    show err
    CREATE OR REPLACE PACKAGE BODY save_table_package AS
    PROCEDURE save_test2_row(i_id NUMBER
    ,i_ename VARCHAR2
    ,i_mgr_id NUMBER
    ,i_mgr_ename VARCHAR2
    IS
    BEGIN
    DBMS_OUTPUT.PUT_LINE('Enter pkg.save_test2_row:'&#0124; &#0124;TO_CHAR(save_table_package.saved_test2_num,'099999'));
    save_table_package.saved_test2(saved_test2_num).id := i_id;
    save_table_package.saved_test2(saved_test2_num).ename := i_ename;
    save_table_package.saved_test2(saved_test2_num).mgr_id := i_mgr_id;
    save_table_package.saved_test2(saved_test2_num).mgr_ename := i_mgr_ename;
    DBMS_OUTPUT.PUT_LINE('Saved Details Of Row ###:' &#0124; &#0124;
    TO_CHAR(save_table_package.saved_test2_num,'099999') &#0124; &#0124;'('&#0124; &#0124;
    TO_CHAR(save_table_package.saved_test2(saved_test2_num).id,'099') &#0124; &#0124;','&#0124; &#0124;
    save_table_package.saved_test2(saved_test2_num).ename &#0124; &#0124;','&#0124; &#0124;
    save_table_package.saved_test2(saved_test2_num).mgr_id &#0124; &#0124;','&#0124; &#0124;
    save_table_package.saved_test2(saved_test2_num).mgr_ename &#0124; &#0124;')'
    save_table_package.saved_test2_num := save_table_package.saved_test2_num + 1;
    DBMS_OUTPUT.PUT_LINE('Leave pkg.save_test2_row:'&#0124; &#0124;TO_CHAR(save_table_package.saved_test2_num,'099999'));
    END save_test2_row;
    PROCEDURE clear_rows IS
    BEGIN
    DBMS_OUTPUT.PUT_LINE('Enter pkg.clear_rows :'&#0124; &#0124;TO_CHAR(save_table_package.saved_test2_num,'099999'));
    save_table_package.saved_test2_num := 1;
    DBMS_OUTPUT.PUT_LINE(' Leave pkg.clear_rows :'&#0124; &#0124;TO_CHAR(save_table_package.saved_test2_num,'099999'));
    END clear_rows;
    END save_table_package;
    show err
    The Triggers
    CREATE OR REPLACE TRIGGER trig_bfr_iup_test2_fer
    BEFORE INSERT OR UPDATE OF mgr_id ON test2 FOR EACH ROW
    DECLARE
    BEGIN
    DBMS_OUTPUT.PUT_LINE('Enter before insupd:'&#0124; &#0124;TO_CHAR(save_table_package.saved_test2_num,'099999'));
    save_table_package.save_test2_row(:new.id
    ,:new.ename
    ,:new.mgr_id
    ,:new.mgr_ename);
    DBMS_OUTPUT.PUT_LINE('Leave before insupd:'&#0124; &#0124;TO_CHAR(save_table_package.saved_test2_num,'099999'));
    END;
    show err
    CREATE OR REPLACE TRIGGER trig_aft_iup_test2_stm
    AFTER INSERT OR UPDATE OF mgr_id ON test2
    DECLARE
    BEGIN
    DBMS_OUTPUT.PUT_LINE('Enter after insupd:'&#0124; &#0124;TO_CHAR(save_table_package.saved_test2_num,'099999'));
    FOR i IN 1 .. save_table_package.saved_test2_num - 1
    LOOP
    UPDATE test2 eme
    SET mgr_ename = (SELECT mgr.ename
    FROM test2 mgr
    WHERE mgr.id = eme.mgr_id)
    WHERE eme.id = save_table_package.saved_test2(i).id
    DBMS_OUTPUT.PUT_LINE('MGR_ENAME Set Row#:'&#0124; &#0124;TO_CHAR(i,'099999'));
    END LOOP;
    save_table_package.clear_rows;
    DBMS_OUTPUT.PUT_LINE('Leave after insupd:'&#0124; &#0124;TO_CHAR(save_table_package.saved_test2_num,'099999'));
    END;
    show err
    null

  • Selecting from dual

    Does anyone have a list of all of the environment selections available from dual.
    e.g. select user from dual;
    Thanks in advance
    Bob

    Hi Bob,
    there are a lot of usful selections possible using DUAL. For more
    information I'd like to suggest you to look into SQL Reference Guide
    chapter 4, which describes for example the powerful SYS_CONTEXT
    function.
    Regards,
    Roland
    Find attached some usful examples on using dual:
    ================================================
    Current session:
    ================
    SQL> select sid,serial#
    from v$session
    where audsid in (SELECT USERENV('SESSIONID') FROM DUAL);
    SID SERIAL#
    13 830
    Which protocol is currently used for connection?
    ================================================
    SQL> SELECT SYS_CONTEXT('USERENV','NETWORK_PROTOCOL') from dual;
    SYS_CONTEXT('USERENV','NETWORK_PROTOCOL')
    tcp
    When nothing will be returned then you're using the BEQUEATH protocol.
    (Session on loacal server that has connected without using a listener)
    Which IP address will be used by session?
    =========================================
    SQL> SELECT SYS_CONTEXT('USERENV','IP_ADDRESS') "My IP Address" from dual;
    My IP Address
    140.84.134.14
    Which NLS Environment will be used?
    ===================================
    SQL> SELECT SYS_CONTEXT('USERENV','LANGUAGE') "nls_lang" from dual;
    nls_lang
    AMERICAN_AMERICA.WE8ISO8859P1

  • Saving result from sp_executesql into a variable and using dynamic column name - getting error "Error converting data type varchar to numeric"

    Im getting an error when running a procedure that includes this code.
    I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql
    DECLARE @retval AS DECIMAL(12,2)
    DECLARE @MonthVal VARCHAR(20), @SpreadKeyVal INT
    DECLARE @sqlcmd AS NVARCHAR(150)
    DECLARE @paramdef NVARCHAR(150)
    SET @MonthVal = 'Month' + CAST(@MonthNumber AS VARCHAR(2) );
    SET @SpreadKeyVal = @SpreadKey; --CAST(@SpreadKey AS VARCHAR(10) );
    SET @sqlcmd = N' SELECT @retvalout = @MonthVal FROM dbo.CourseSpread WHERE CourseSpreadId = @SpreadKeyVal';
    SET @paramdef = N'@MonthVal VARCHAR(20), @SpreadKeyVal INT, @retvalout DECIMAL(12,2) OUTPUT'
    --default
    SET @retval = 0.0;
    EXECUTE sys.sp_executesql @sqlcmd,@paramdef, @MonthVal = 'Month4',@SpreadKeyVal = 1, @retvalout = @retval OUTPUT;
    SELECT @retval
    DECLARE @return_value DECIMAL(12,2)
    EXEC @return_value = [dbo].[GetSpreadValueByMonthNumber]
    @SpreadKey = 1,
    @MonthNumber = 4
    SELECT 'Return Value' = @return_value
    Msg 8114, Level 16, State 5, Line 1
    Error converting data type varchar to numeric.

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    >> I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql <<
    This is so very, very wrong! A column is an attribute of an entity. The idea that you are so screwed up that you have no idea if you want
    the shoe size, the phone number or something else at run time of this entity. 
    In Software Engineering we have a principle called cohesion that says a model should do one and only one task, have one and only one entry point, and one and only one exit point. 
    Hey, on a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, your mindset is that level of sillyity and absurdity. 
    Do you know that SQL is a declarative language? This family of languages does not use local variables! 
    Now think about “month_val” and what it means. A month is a temporal unit of measurement, so this is as silly as saying “liter_val” in your code. Why did you use “sp_” on a procedure? It has special meaning in T-SQL.  
    Think about how silly this is: 
     SET @month_val = 'Month' + CAST(@month_nbr AS VARCHAR(2));
    We do not do display formatting in a query. This is a violation of at the tiered architecture principle. We have a presentation layer. But more than that, the INTERVAL temporal data type is a {year-month} and never just a month. This is fundamental. 
    We need to see the DDL so we can re-write this mess. Want to fix it or not?
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Why a function within a SELECT FROM DUAL is faster?

    1)I have a SELECT with a function. Ex:
    "SELECT DISTINCT function(...) FROM table"
    2)I changed the SELECT and put the function inside a SUB-SELECT with FROM DUAL. Ex:
    "SELECT DISTINCT (SELECT function(...) FROM DUAL) FROM table"
    3)The second SELECT is faster than the first.
    I discovered this problem on my tables and my functions. So I did a generic example for this forum with a common function and large table. My results:
    Table has 2.196.058 records and the field is a VARCHAR2:
    SELECT DISTINCT SUBSTR(field, 2) FROM Table -> Executed in 110 seconds
    SELECT DISTINCT (SELECT SUBSTR(field, 2) FROM DUAL) FROM Table -> Executed in 39 seconds
    Why "SELECT DISTINCT (SELECT function(...) FROM DUAL) FROM table" is faster than "SELECT DISTINCT function(...) FROM table"
    thanks,
    Fernando

    Hi hoek,
    I followed your informations and, sorry, I am more confused! I did an interesting example below.
    1)I created a table:
    CREATE TABLE T
         name VARCHAR2(50)
    );     2)I inserted 10 lines:
    NAME                                              
    A                                                 
    B                                                 
    C                                                 
    D                                                 
    E                                                 
    F                                                 
    G                                                 
    H                                                 
    I                                                 
    J                                                  3)I created a function that returns the parameter concatenated with the current millisecond:
    CREATE OR REPLACE FUNCTION f (param1 IN VARCHAR2) RETURN VARCHAR IS
    BEGIN
         return param1 || '-' || to_char(CURRENT_TIMESTAMP, 'FF');
    END;     4)The query(A): SELECT f(name) AS col1, f(name) AS col2, f(name) AS col3 FROM t; gave me:
    COL1        COL2        COL3
    A-693786000 A-693887000 A-693941000
    B-693989000 B-694017000 B-694043000
    C-694071000 C-694097000 C-694124000
    D-694153000 D-694180000 D-694206000
    E-694235000 E-694261000 E-694287000
    F-694316000 F-694341000 F-694367000
    G-694396000 G-694422000 G-694448000
    H-694477000 H-694503000 H-694529000
    I-694557000 I-694583000 I-694609000
    J-694638000 J-694664000 J-694690000If I repeat the SELECT, new values are generated.
    4)The query(B): SELECT (SELECT f(name) FROM Dual) AS col1, (SELECT f(name) FROM Dual) AS col2, (SELECT f(name) FROM Dual) AS col3 FROM t; gave me:
    COL1        COL2        COL3
    A-253546000 A-253643000 A-253746000
    B-253791000 B-253821000 B-253850000
    C-253881000 C-253909000 C-253937000
    D-253969000 D-253997000 D-254026000
    E-254057000 E-254085000 E-254113000
    F-254145000 F-254173000 F-254202000
    G-254232000 G-254261000 G-254289000
    H-254320000 H-254348000 H-254376000
    I-254407000 I-254436000 I-254464000
    J-254495000 J-254523000 J-254551000The result generated new values too.
    5)I changed the function and I put the DETERMINISTIC clause:
    CREATE OR REPLACE FUNCTION f (param1 IN VARCHAR2) RETURN VARCHAR DETERMINISTIC IS
    BEGIN
         return param1 || '-' || to_char(CURRENT_TIMESTAMP, 'FF');
    END;     6)I repeated the queries(A) and (B) and the result has generated different values. Then, with the DETERMINISTIC clause, the result has not changed
    7)I changed the function and I put the RESULT_CACHE clause:
    CREATE OR REPLACE FUNCTION f (param1 IN VARCHAR2) RETURN VARCHAR RESULT_CACHE IS
    BEGIN
         return param1 || '-' || to_char(CURRENT_TIMESTAMP, 'FF');
    END;8)I repeated the query(A) and now, the result was different:
    COL1        COL2        COL3
    A-381048000 A-381048000 A-381048000
    B-381242000 B-381242000 B-381242000
    C-381322000 C-381322000 C-381322000
    D-381400000 D-381400000 D-381400000
    E-381481000 E-381481000 E-381481000
    F-381556000 F-381556000 F-381556000
    G-381634000 G-381634000 G-381634000
    H-381815000 H-381815000 H-381815000
    I-381895000 I-381895000 I-381895000
    J-381971000 J-381971000 J-381971000The line columns are equals and if I repeat the SELECT, all the result is the same too. The query(B) returned the same result like the query(A)! Now I see the cache in action!
    After the tests, I concluded that the function in the subquery doesn't use cache and it is faster than the normal function. The mistery continues...

  • Inserting multiple selection from checkbox into one column of the database

    Hi,
    How to insert multiple selection values from checkbox into one column of the database.
    Anyone can u help me
    Thanx

    hi
    try to use request.getParameterValues("fieldname")

  • How to select for insert a long column through database link?

    How may a long column (for example a sql server 2000 text column) be selected for insert into a clob column in table in 10g over a database link without invoking ora-00997?
    I've tried using dbms_metadata_util.long2clob without success over a database link.

    Is the remote database an Oracle database? Or are you selecting data from SQL Server 2000 over a database link via Heterogeneous Services? What is the data type of the column in the remote database (LONG? TEXT? Something else?)?
    Justin

  • Passing jsp variable through a link

    hi everybody!!
    can anyone help me? i am in great trouble. Here is my problem description....
    I have one jsp page named a1.jsp in this page i have some checkbox in a form. an html link.
    I select a checkbox and when i click the link then onclick() event of the link execute the javascript function and take the value of the checkbox in a variable.
    I want to take the value to the page a2.jsp when i click the link.
    Please help me!!
    Here is my sample code............
    this is the code of a1.jsp page
    when i click the link named(click the link below i ) i want to go to page a2.jsp by taking the script variable a;
    <script>
    var a=" ";     
    function submitForm()
    a="shakil";
    </script>
    <a href="a2.jsp" onClick="submitForm();">Click the  link</a>_______________________________________________________

    hi,
    a1.jsp
    <script>
    var a=" ";     
    function submitForm()
         a="shakil";
    window.top.location.href ="./a2.jsp?a="+ a;
    </script>
    Click the linka2.jsp
    hello: <%=request.getParameter ( "a" ) %>

  • Select * from table into table field-symbol

    Hello,
    I am trying to do a dynamic select into a dynamically defined internal table (field-symbol), but it doesn't work like I expected.
    if I try this code :
    data : p_tabname type string value 'PA9006',
          dref type ref to data .
    FIELD-symbols: <struc> TYPE ANY.
    CREATE DATA dref TYPE table of (p_tabname).
    ASSIGN dref->* TO <struc>.
    SELECT * INTO  TABLE <struc> FROM (p_tabname)  .
    I get the following error :
    <struc> is not an internal table.
    Is there any way I can make this work?
    Points will be assigned for each usefull answer.

    Hi Dries
    Just change your declaration of <struc> to as below it would work,
    field-symbols : <struc> type standard table.
    Reward points if useful.
    ~Ranganath

  • Select from ODS into .CSV file

    hi guru's !
    I need to build an abap program that reads a number of fields from an ODS (table) and stores this result in a .CSV file.
    I have never done this before so any documentation or examples would be greatly appreciated !
    thanks alread !

    hi,
    http://help.sap.com/saphelp_nw04/helpdata/en/c7/dc833b2ab3ae0ee10000000a11402f/frameset.htm
    Regards,
    Sourabh

  • Accessing a packaged variable through db link

    How do I access a packaged variable remotely? (Syntax)

    You cannot do that:
    SQL> conn xx/xx@xx
    Connected.
    SQL> create package p is
      2   a number;
      3  end;
      4  /
    Package created.
    SQL> conn yy/yy@yy
    Connected.
    SQL> desc p@yy
    SQL> set serveroutput on
    SQL> create synonym p1 for p@xx;
    Synonym created.
    SQL> desc p1;
    SQL> begin
      2    p1.a := 1;
      3    dbms_output.put_line(p.a);
      4  end;
      5  /
      p1.a := 1;
    ERROR at line 2:
    ORA-06550: line 2, column 6:
    PLS-00512: Implementation Restriction: 'P1.A': Cannot directly access remote package variable or cursor
    ORA-06550: line 2, column 3:
    PL/SQL: Statement ignoredInstead you should access these variables via functions and/or procedures. In following example I've created the private variable in package p but this doesn't matter whether it is private or public.
    SQL> conn xx/xx@xx
    SQL> create or replace package p is
    2 procedure set_a (v in number);
    3 function get_a return number;
    4 end;
    5 /
    Package created.
    SQL> ed
    Wrote file afiedt.buf
    1 create or replace package body p is
    2 a number;
    3 procedure set_a (v in number) is
    4 begin
    5 a := v;
    6 end;
    7 function get_a return number is
    8 begin
    9 return a;
    10 end;
    11* end;
    SQL> /
    Package body created.
    SQL> conn yy/yy@yy
    Connected.
    SQL> set serveroutput on
    SQL> desc p1
    FUNCTION GET_A RETURNS NUMBER
    PROCEDURE SET_A
    Argument Name Type In/Out Default?
    V NUMBER IN
    SQL> ed
    Wrote file afiedt.buf
    1 begin
    2 p1.set_a(1);
    3 dbms_output.put_line(p1.get_a);
    4* end;
    SQL> /
    1
    PL/SQL procedure successfully completed.
    Gints Plivna
    http://www.gplivna.eu

  • Accessing package variable through DB link

    Hi,
    I have ref cursor variable in remote DB package and want to refer that in another script.
    v_refcur rem_package.generic_cursor_type@REMOTEDB
    and accessing procedure in the remote DB
    I am getting the following error
    ORA-20111: ORA-02064: distributed operation not supported
    ORA-06512: at "user.XXHJ_API", line 1097
    ORA-06512: at line 43
    any help is appreciated..

    Ref Cursors are not supported across databases.
    Explain in more detail as to what you are trying to achieve and someone here can suggest alternatives.

  • Why sql select 'Hello'||'world012345678' from dual; cause error?

    I have problem and your help to solve it would be very much appreciated.
    Can anybody tell why the result is so different for the following two sql-sentence in SQL/PLus?
    sql>select 'Hello'||'world012345678' from dual;
    sql>select 'Hello'||'world0123456789' from dual;
    sql>select 'Hello'||'world012345678' from dual;
    Result:
    select 'Hello'||'world012345678' from dual
    ERROR at line 1:
    ORA-00600: internal error code, arguments: [17182], [158346180], [], [], [],
    sql>select 'Hello'||'world0123456789' from dual;
    Helloworld0123456789
    I found that if the length of one string equals 14, then the sql will failed as the first sentence.

    If you need to check the validity of DUAL then you have:
    Select count(1) from DUAL ;
    NOT
    Select * from DUAL;
    If you find more than 1, then
    delete from dual;
    insert into dual values ('x') ;
    commit;
    Then, try you offending query.

Maybe you are looking for

  • Problems of the new iPod

    After one week testing the new iPod (60 Giga), i'm not happy to say that i'm quite disappointed. I've a music library of 35 gigs and around 3000 photos. Few videos. The major problem i've noticed is the artwork loading/displayng. In shuffle mode, art

  • Error -50 when trying to purchase songs from itunes store

    When I try to purchase songs from itunes store I get error -50 or the message that their is not internet connectivity (which is not the case). Any suggestions for a way to fix this?

  • Audit log + manual update + specify download location

    Hi all, I'm evaluating whether we can use Java Web Start for our new product, for geographically distributed software deployment. I've the following questions that I could not find answers in the official documentation: - Can it support manual update

  • Search purchase requisition class

    Hi all, i search a class for manipulate purchase requisition object. I don't find it. For purchase order i use CL_PO_HEADER_HANDLE_MM, but for purchase requisition ? Thanks a lot. Cheers.

  • Datafile name still there in dba_data_files

    Hi One of my friend called me to ask about an issue with Oracle 8i on Solaris. Actually he is trying to create one tablespace (say TEST1) but it gives an error about the datafile that its already part of the database. Now there is no entry in DBA_TAB