Function 'myfunc' may not be used in SQL Options

<p>
Hello,
I have created a simple function in a packege for use in an update statement. The function is
FUNCTION myfnc(p1 IN t1.c1%TYPE)
RETURN VARCHAR2
IS
BEGIN
IF p1 = 3 THEN
RETURN 'A';
ELSE
RETURN 'B';
END IF;
END myfnc;
I use it in a procedure which exists in the same package as the function as follows
Update t1
set c1 = myfnc(c2);
I am getting the compliation error Function 'myfunc' may not be used in SQL.
There is no db manipulation going on and I have tried using
PRAGMA RESTRICT_REFERENCES (myfnc, WNDS, WNPS, RNDS, RNPS);
but to no avail.
One other thing is that I thought this was compiling OK but then I decided to put the function in the package specification so I could unit test it using a db call. Now if I drop and recreate the package without the declaration in the specification the compile error still occurs. Perhaps that's my mind playing tricks but maybe there is something here I am not aware of.
Any suggestions?
</p>

Hi,
You found the solution.
Although it's allowed to say
Update     t1
set     c1 = local_var;in a package, where local_var is not defined outside of the procedure, let alone the package, and
although it's legal to say:
local_var = myfnc (some_other_var); inside the package where myfnc is a private function (included in the package body, but not in the package header), still
it is not legal to say:
Update     t1
set     c1 = myfnc (c2); If there is a problem with putting myfnc in the package header (for example, you don't want people calling it directly, for some reason), you can make it a stand-alone function, like Someoneelse did, or put in a different package, and give the owner of your first package (and no one else) EXECUTE privileges on it.
As William pointed out, if myfnc is really this simple, you might not need a function at all.

Similar Messages

  • Function name_function may not be used in SQL

    Dear forums,
    when i compiled my form that contain the function package, i got the error "Function <name_function> may not be used in SQL". But when i execute the function from sql plus, it works smoothly.
    What's the solution ?
    with great thanks,

    Hi Salim,
    as far as I understand you you try to use a function that is stored in the form. The select statement is worked on the database where your function is not known. You have to create this function on the database as you did it for using in SQLPlus.
    Regards,
    Werner

  • Function may not be use in SQL - PLS-00231

    Here is my code,
    -- Database 10g Enterprise Edition Release 10.2.0.2.0
    declare
    v1 varchar2(2000);
    function test_func ( v2 varchar2) return varchar2
    is
    begin
    return v2 || 'x' || v2;
    end;
    begin
    -- ok
    v1 := test_func('Hello');
    --- Error PLS-00231: Function may not be used
    --insert into xxxx values test_func(….
    select test_func('World') into v1 from dual;
    end;
    I don’t want to define test_func in database as a stand-alone/package function. Is there any other way in 10G.
    Thanks.

    Works for me...
    SQL> select banner from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
    PL/SQL Release 10.2.0.3.0 - Production
    CORE 10.2.0.3.0 Production
    TNS for Solaris: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    SQL> set serverout on
    SQL> declare
    2 v1 varchar2(2000);
    3 function test_func ( v2 varchar2) return varchar2
    4 is
    5 begin
    6 return v2 || 'x' || v2;
    7 end;
    8 begin
    9 -- ok
    10 v1 := test_func('Hello');
    11 dbms_output.put_line (v1);
    12 end;
    13 /
    HelloxHello
    PL/SQL procedure successfully completed.

  • Function 'function name' may not used in sql

    Hi Guys,
    How to call a function in a form level trigger?
    i created a function in program unit.In timer expired trigger i tried to call a function as
    select sf1('a') from dual;Im getting below error
    function sf1 may not use in sqlAdvance thanks

    Hi,
    If you want to assign the return value of the function to a variable then you can try
    <variable_name> := sf1('a');Else, you can write
    select sf1('a') into <variable_name> from dual;Hope this helps.
    Regards,
    Manu.

  • See my error : (REP-1272: Column ‘CF_1’ may not be used as break Column.)

    Hi master
    Sir I have master detail report and I use one formula column and one place holder column in my report in master section
    I use this code
    function CF_1Formula return Date is
    begin
    if :chqdate is not null then
         :cp_1 :=:chqdate;
    else
         :cp_1 :=:sdate;
         end if;
    end;
    Sir when I run my report then system give me this error
    REP-1272: Column ‘CF_1’ may not be used as break Column.
    Please give me idea how I get report
    Thank
    aamir

    Hello,
    Break Order cannot be used for some Column Type :
    http://www.oracle.com/webapps/online-help/reports/10.1.2/topics/htmlhelp_rwbuild_hs/rwcontxt/props/pi_col_break_order.htm
    (CLOB is not explicitly specified, but the restriction for LONG and LONG RAW exists for CLOB too)
    Regards

  • ORA-01409 NOSORT option may not be used

    Hi all,
    We've got a range partitioned table, each partition resides in a different tablespace (locally managed) thus :
    create tablespace abcblast_hit_test_data1
    datafile '/export/data/oracle/HLDDEV05/abcblast_hit_test_data1.dbf'
    size 2600m extent management local uniform size 2500m;
    create tablespace abcblast_hit_test_data2
    datafile '/export/data/oracle/HLDDEV05/abcblast_hit_test_data2.dbf'
    size 2600m extent management local uniform size 2500m;
    Two large SORTED files of data are sql*loaded into each partition, taking up ONE extent in each partition
    I then try to create a non-unique index on the table using NOSORT and get the error ORA-01409 NOSORT option may not be used; rows are not in ascending order
    ... with the following reasoning :
    For non-unique indexes the ROWID is considered part of the index key. This means that two rows that appear to be stored in ascending order may not be. If you create an index NOSORT, and two of the rows in the table have the same index values, but get split across two extents, the data block address of the first block in the second extent can be less than the data block address of the last block in the first extent. If these addresses are not in ascending order, the ROWIDs are not either. Since these ROWIDs are considered part of the index key, the index key is not in ascending order, and the create index NOSORT fails.
    BUT the data for each partition DOES reside in one extent :
    select partition_name, tablespace_name, extent_id, bytes
    from dba_extents
    where segment_name = 'ABCBLAST_HIT'
    and segment_type = 'TABLE PARTITION';
    PARTITION_NAME     TABLESPACE_NAME          EXTENT_ID     BYTES
    PART_01          ABCBLAST_HIT_TEST_DATA1     0          2621440000
    PART_02          ABCBLAST_HIT_TEST_DATA2     0          2621440000
    (Oracle 9.0.1 on Linux)
    HELP !!!! Does this mean we can't use NOSORT when building indexes on partitioned tables ?!
    (Note : if NOSORT is not used then a sort is performed which we are trying to avoid - final table will contain 1.6 billion rows and will consist of 50 partitions)

    Hi ,
    Still i am facing same error like. Can any body help me..
    The following index(es) on table KA31CVLA.CITY were processed:
    index KA31CVLA.CITY_PK was made unusable due to:
    ORA-01409: NOSORT option may not be used; rows are not in ascending order
    index KA31CVLA.CITY_UQ01 loaded successfully with 29761 keys
    i have create one table CITY in user KA31CVLA.
    CREATE TABLE CITY
    CNTRY_CD VARCHAR2(2 BYTE) NOT NULL,
    CITY_NM VARCHAR2(40 BYTE) NOT NULL,
    SEQ_NBR NUMBER(10) NOT NULL,
    POSTL_STT_EQNT_CD VARCHAR2(9 BYTE),
    LATITUDE NUMBER(9,5) NOT NULL,
    LONGITUDE NUMBER(9,5) NOT NULL
    and then added primary constraints
    ALTER TABLE CITY ADD CONSTRAINT KA31CVLA.CITY_PK PRIMARY KEY (CNTRY_CD, CITY_NM, SEQ_NBR)
    after this default unique index created as below
    CREATE UNIQUE INDEX KA31CVLA.CITY_PK ON KA31CVLA.CITY (CNTRY_CD, CITY_NM, SEQ_NBR)
    after that i have added one more constraints is
    CREATE UNIQUE INDEX KA31CVLA.CITY_UQ01 ON KA31CVLA.CITY (CITY_NM, POSTL_STT_EQNT_CD, CNTRY_CD, SEQ_NBR)
    Now trying to load data to KA31CVLA.CITY table through SQLLDR
    here is the command which i am executing to insert..
    SQLLDR CONTROL=D:\GMVS\city.ctl, DATA=D:\GMVS\sorted_city.dat log=D:\GMVS\sorted_log.log USERID="KA31CVLA/KA31CVLA123" DIRECT=Y
    Here is the control file details
    options (direct=true)
    unrecoverable
    load data
    truncate
    into table KA31CVLA.city
    sorted indexes (city_PK)
    reenable disabled_constraints
    fields terminated by "^"
    trailing nullcols
    (cntry_cd char,
    city_nm char,
    seq_nbr integer external,
    postl_stt_eqnt_cd Char,
    latitude integer external,
    longitude integer external)
    The total records insertd to table but i am getting above error in log files.
    The following index(es) on table KA31CVLA.CITY were processed:
    index KA31CVLA.CITY_PK was made unusable due to:
    ORA-01409: NOSORT option may not be used; rows are not in ascending order
    index KA31CVLA.CITY_UQ01 loaded successfully with 29761 keys

  • Customer for function SP may not have account group in sap

    Dear All,
    Not open the sales order and error show in SAP
    Customer for function SP may not have account group.

    In IMG > SD > Basic Function > Set up Partner Determination
    Check the assignment of Partner Function with the Account Group in Account Groups - Function Assignment.
    Best Regards,
    Ankur

  • Entity type "EJB-JAR" may not be used in public part "ejbjar_api"

    Experts,
    Can you please help me to identify why the error 'Entity type "EJB-JAR" may not be used in public part "ejbjar_api", unsupported purpose.' appears on NWDS while creating a project on a DC and how can this be resolved.
    Thanks in advance
    -Lave

    Hi Jain,
    is the error message that the public part is not found prefixed with [dcmake]? If yes that rather points in the direction that there is a problem with the metadata information. (PP name not correctly spelled, renamed after initial creation, perhaps even some problems with upper/lower-case letters depending on your platform.)
    What SP are you using? The log looks like some rather old build plugins are used on a newer NWDI installation.
    The warning from the [wdgen] task and the subsequent failure of the [wdminimizer] can be ignored. "ERROR: Non Fatal Error" is a bit quaint, but it really is not fatal. It just means that the minimizer didn't find the data required to operate. The [wdgen] warning means that the WebDynpro generator could not write the information. So the jar files in your public part are maybe a bit bigger than necessary but that's all.
    Best regards,
    Marc

  • TBB1-Execute postings occurs an error *Ledger group 0L may not be used*

    Hi everybody,
    While trying to execute postings from a commercial paper occurs the following error
    Ledger group 0L may not be used
    Message no. FAGL_LEDGER_CUST102
    Diagnosis
    Ledger group &1 is assigned to another application.
    I suspect that this is somehow related to Funds management influence, but I can not find the solution,
    I really need to overcome this problem so i'll appreciate any help,
    Thanks in advance,
    Daniel

    Hi Prasad,
    We created ledger groups in costumizing this issue was solved.
    Thank you very much your help.
    Regards,
    Daniel

  • Release 1.5, 'enum' is a keyword, and may not be used as an identifier.help

    hello
    i am working for a MNC and i am trying to build my prduct in JDK1.5 and i am getting this error...
    ...release 1.5, 'enum' is a keyword, and may not be used as an identifier...
    the probelm is that i cant go to 1.4 as my product suports only 1.5 and above ..
    give me asolutin as fast as possible...

    hello
    i am working for a MNC and i am trying to build my
    prduct in JDK1.5 and i am getting this error...
    ...release 1.5, 'enum' is a keyword, and may not be
    used as an identifier...
    What am I missing? Don't use the 'enum' as a variable name!

  • Error  "Ledger group 0L may not be used" - CO15

    Dear guru,
    When I want to save Production Order Confirmation via CO15, there is an error message :
    Ledger group 0L may not be used
    Message no. FAGL_LEDGER_CUST102
    Diagnosis
    Ledger group &1 is assigned to another application.
    FYI, when I check tabel T881 (Ledger Master), there are two leading ledger : 0L and OL. It's very strange.
    As far as I know, in standard SAP there is only one leading ledger, it is 0L.
    I check in customizing (Ledger > Define Ledgers for General Ledger Accounting), there is only one ledger: OL (as leading ledger), so I untick Leading Ledger indicator for Ledger 0L directly on table T881, but the error message still appear.
    How to solve this?
    Thanks before

    Hi Hanny Ali,
    The message F5 670 is processed if there is a problem in account determination. The message means the account determination in the SD billing document does not work probably. This could also be caused by a wrong or incomplete customizing.
    Please find note 146879 to check the customizing on this issue. From past messages, this problem is usually caused by a missing or incorrect customizing for the G/L account.
    Please note that if it's a case of a cancellation document the field VBRK-SFAKN is filled. When this is filled the system does not carry out account determination. In debug you can remove this entry and the account determination will be revoked. This would resolve the issue.
    Could you please review customizing setting VKOA if all the relevant information are being maintain correctly?
    Please also review the notes:
    -> 0216974 Error F5670 during release to accounting
    -> 0113512 VF051 "Doc. & saved (error in accnt determination)
    -> 1325446 SDBONT06: G/L accounts of rebate conditions are
    I hope this answer your issue with error F5 670.
    Best Regards,
    Vanessa.

  • "ORA-1715 : UNIQUE may not be used with a cluster index" but why?

    "ORA-1715 : UNIQUE may not be used with a cluster index" but why and what "may" means here? Any comments will be welcomed, thank you and best regards;
    show rel
    release 1002000300
    CREATE CLUSTER sc_srvr_id (
    srvr_id NUMBER(10)) SIZE 1024;
    SELECT cluster_name, tablespace_name, hashkeys,
    degree, single_table FROM user_clusters;
    CREATE UNIQUE INDEX idx_sc_srvr_id ON CLUSTER sc_srvr_id;
    ERROR at line 1:
    ORA-01715: UNIQUE may not be used with a cluster index
    CREATE INDEX idx_sc_srvr_id ON CLUSTER sc_srvr_id;
    SELECT index_name, index_type, tablespace_name
    FROM user_indexes where index_name like '%SRVR%' ;
    CREATE TABLE cservers (
    srvr_id    NUMBER(10),
    network_id NUMBER(10),
    status     VARCHAR2(1),
    latitude   FLOAT(20),
    longitude  FLOAT(20),
    netaddress VARCHAR2(15))
    CLUSTER sc_srvr_id (srvr_id);
    ALTER TABLE cservers add constraint pk_srvr_id primary key (srvr_id ) ;
    SELECT index_name, index_type, tablespace_name
    FROM user_indexes where index_name like '%SRVR%' ;
    INDEX_NAME                     INDEX_TYPE
    TABLESPACE_NAME
    IDX_SC_SRVR_ID                 CLUSTER
    USERS
    PK_SRVR_ID                     NORMAL
    USERSdo we really need another pkey index here?

    "May" has different meanings, one of which is:
    (used to express opportunity or permission)
    Metalink note 19067.1 says:
    This is not permitted.
    ... which agrees with the above meaning of it.
    Besides these, it does not make any sense to me to create a unique index on a cluster. You can have primary keys in the tables you include in the cluster, it depends on your business requirement. But why do you need a unique index on a cluster?

  • Error with new function u00E9lement is not in use

    I designed quickly a new function in the backend with no input and only output which give me the url off the bsp server. (since there is nobody in the house who can make the iview bsp template)
    I select the function from find data and put it in the model which gives the output to a store. when I deploy I get an error 1.1
    element 'z retrieve http server' is not in use
    anybody any clue what to do ??
    kind regards
    arthur de smidt

    thanks for the help but I already find out what happenend. I had linked my function direct to a store but apperantly there is no trigger for the function to execute since it is on it's own without input needed. apparently I have to trigger it to implement it in a flow or something like that
    kind regards
    arthur

  • Trace not generated using  Initialization SQL Statement - Custom profile

    Im following the steps given below to generate trace :
    Navigate to System Administrator > Profile > System
    Check --User and provide the User for which the tracing has to be set.
    In the Profile field provide Initialization%SQL%Custom and click Find-- button.
    (b) In the User Value column on the Profile Values form, enter the statement shown below and click 'Save'.
    BEGIN FND_CTL.FND_SESS_CTL('','','','','','ALTER SESSION SET max_dump_file_size=5000000 EVENTS=''10046 TRACE NAME CONTEXT FOREVER, LEVEL 12'''); FND_TRACE.SET_TRACE_IDENTIFIER('XXXTEST'); END;
    Note: Specify an identifier to help you identify your trace file. XXXTEST was used in this case and will show at the end of the trace file name.
    You may need to set the MAX_DUMP_FILE_SIZE to UNLIMITED if the file is truncated
    But the the trace is not getting generated. I searched user_dump_dest and all other location but couldn't find a file with the name "XXXTEST".
    kindly help....

    Hİ;
    I suggest please check How To Trace a Concurrent Request And Generate TKPROF File [ID 453527.1]. If you are sure your system generate trace, you may go with find -name xx.trace
    Regard
    Helios

  • Power view not working using remote sql

    Hi
    Our Sharepoint 2013 has all it's content databases installed on a sql server 2008 R2
    And our BI guys would like to use power view with the data on their SQL 2012 SP1.
    How should I proceed with the setup?
    At the moment I can't find any powerview integration feature to switch on, how should I do this?
    Do I need to install the Reporting Services Add-in for Sharepoint on the sharepoint servers?
    Anders

    PowerView requires SSRS in SharePoint integrated mode. Install SSRS on a SharePoint server in your farm and configure the SSRS Service Instance/Service Application, then try again.
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

Maybe you are looking for