PLS-00231 - function cannot be used in SQL

Morning you all,.

Please, don't ask me not to do this kind of function, because I cut the pieces that are not important information to my question. Thank you.

Package:

function PL_Fun)

P_COD1 IN VARCHAR2,

P_COD2 NUMBER,

P_COD3 NUMBER) RETURN VARCHAR2;

PROCEDURE PL_Prod (P_CURSOR1 ON C_RETURN);

Package body:


Function PL_Fun)

P_COD1 IN VARCHAR2,

P_COD2 NUMBER,

P_COD3 NUMBER) RETURN VARCHAR2 AS

SALIDA VARCHAR2 (3000);

BEGIN

Salida: ='XXXXX1; YYYYY1; S |

XXXXX2; YYYYY2; S |

XXXXX3; YYYYY3; S |

XXXXX41; YYYYY4; S |' ;

RETURN of SALIDA;

END PL_FUN;

PROCEDURE PL_Prod (P_CURSOR1 ON C_RETURN) IS

nothing exceptional;

V_CODERROR VARCHAR2 (3);

V_DESERROR varchar2 (300);

BEGIN

OPEN FOR P_CURSOR1

SELECT PL_Fun (table1.v_cod1, )

                                       table1.v_cod2,

                                       table1.v_cod3) as description

FROM TABLE1;

EXCEPTION

When is nothing THEN

V_CODERROR: = '001';

V_DESERROR: = 'nothing. '

RAISE_APPLICATION_ERROR (-20000

V_CODERROR | ':' || V_DESERROR

);

WHILE OTHERS THEN

V_CODERROR: = 'SQL ';

V_DESERROR: =.

«ERROR ON PL_Fun (' |)» SQLCODE. ') ' || SUBSTR (SQLERRM

1

300

);

RAISE_APPLICATION_ERROR (-20000

V_CODERROR | ':' || V_DESERROR);

END PL_Prod;

Error:

Error: PLS-00231: function 'PL_Fun' is not usable in SQL

Text:, PL_Fun (P_COD_1, P_COD_2, P_COD_3) as description

Error: PL/SQL: ORA-00904: invalid identifier

Text:, PL_Fun (P_COD_1, P_COD_2, P_COD_3) as description

Error: PLS-00323: subprogram or cursor "PL_Fun" is declared in a package specification and must be defined in the package body

Text :);

What I'm trying?

Like ask Tom reffers, I changed the position of the packet body,

From:

Function PL_Fun ();

PROCEDURE PL_Prod;

TO:

PROCEDURE PL_Prod;

Function PL_Fun ();


But it did not work. I have the same problem.


And, as I read on another forum, I used the PRAGMA RESTRICT_REFERENCES like the following, but it doesn't work either:

CREATING a PACKAGE LIKE xxxx

Function PL_Fun)

P_COD1 IN VARCHAR2,

P_COD2 NUMBER,

P_COD3 NUMBER) RETURN VARCHAR2;

RESTRICT_REFERENCES PRAGMA (PL_Fun, WNDS, WNPS);

PROCEDURE PL_Prod (P_CURSOR1 ON C_RETURN);

END xxxx;



Any suggestions?


Thank you guys.

Finally... solved. Break for a cup of coffee and lunch... and there's the problem: the function parameters where the same is called not on the statement and the area of the body area. The problem was just a letter. However, none of us (team work) noticed.

Sorry for that and I THANK YOU all for your patience.

Tags: Database

Similar Questions

  • PLS-00363: expression cannot be used as a target of assignment

    Hello

    Oralce9.2

    When I run the insertion process I get the below error:

    Procedure
    --------------

    PROCEDURE proc_one_insert (col1 IN digital OUT,
    col2 IN num,
    numeric IN COL3
    );

    BEGIN
    immediately run proc_one_insert (2,1,111);
    END;
    /


    Error
    ------

    PLS-00363: expression '2' cannot be used as a target of assignment


    How to solve the error above?


    Regarding

    Published by: user640001 on December 2, 2010 03:04

    Example is already there... Recheck the post... v1 is the variable used for the IN OUT parameter.

    Concerning
    Arun

  • PLS-00231: error function

    version: Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - Production

    declare
    v_mail_cust_code maz_sr_au_incentive_cust_hist.mail_cust_code%type;
    function inc_uniq_code
    return varchar2
    is
    v_unique_code maz_sr_au_incentive_cust_hist.mail_cust_code%type;
    Boolean v_unique: = FALSE;
    number of v_count;
    Start
    all in v_unique! = TRUE
    loop
    Select to_char (round (dbms_random.value (1000000,9999999))) in the double v_unique_code;
    Select count (*) in the maz_sr_au_incentive_cust_hist v_count
    where rtrim (mail_cust_code) = v_unique_code;
    If v_count = 0 then
    v_unique: = TRUE;
    end if;
    end loop;
    Return v_unique_code;
    end inc_uniq_code;
    Start
    Select inc_uniq_code in the double v_mail_cust_code;
    dbms_output.put_line ('inc_uniq_code: ' | v_mail_cust_code);
    end;

    error:
    *************
    ORA-06550: line 22, column 8:
    PLS-00231: function 'INC_UNIQ_CODE' cannot be used in SQL
    ORA-06550: line 22, column 8:
    PL/SQL: ORA-00904: "INC_UNIQ_CODE": invalid identifier
    ORA-06550: line 22, column 1:
    PL/SQL: SQL statement ignored

    Can anyone help?

    Thank you
    Rambeau

    This will be triggered through back-end work, users aren't all there for these requirements.

    We have suggested to use the sequence number, but professional user insisted to have a unique random number, the main work is the only one that calls this function.
    I think, therefore, it should not be a problem with the generation random unique number. >

    Why does make a difference that she is called from a work of "back-end" or that users are not present during the loading process?

    In any case, in case it wasn't clear from the comments you have received to date, you can not count the rows in a table as part of an operation that modifies data, because it is for an indefinite period, not to mention unsecure threads.

    I think the reasoning underlying the requirement is that perhaps the company doesn't want anyone to see the order in which files or folders have been loaded, and a sequence that would give away.

  • PLS-00435: without LINKING DML statement to BULK cannot be used

    My requirement

    I dynamically create a staging table my_stg and then fill it out. Seems simple, but do not know why I get this error

    create table gtest4 (myid varchar2 (10), mykey varchar2 (10));


    create table gtest5 (myid varchar2 (10), mykey varchar2 (10));

    insert into gtest4 values (1.3);


    insert into gtest4 values (2.7);

    insert into gtest5 values (5,3);

    insert into gtest5 values (1, 7);

    commit;


    / * Formatted on 2012/01/27 17:52 (trainer more v4.8.8) * /.
    CREATE OR REPLACE PROCEDURE px
    IS
    RecType (RECORD IS of TYPE)
    MyID VARCHAR2 (100),
    MyKey VARCHAR2 (100)
    );

    TYPE tabtype IS rectype TABLE
    INDEX OF DIRECTORY;

    REC tabtype;
    News sys_refcursor;
    BEGIN
    EXECUTE IMMEDIATE ' create table my_stg (myid varchar2 (100), mykey varchar2 (100)) ';

    Heart OPEN FOR "select a.myid, b.mykey
    gtest4 a, gtest5 b
    where a.mykey = b.mykey';

    LOOP
    News FETCH
    COLLECTING LOOSE rec LIMIT 500;

    FORALL I IN 1... recomm. COUNTY
    EXECUTE IMMEDIATE "insert into my_stg (myid, mykey) values (rec (i) .myid,
    Rec (i). MyKey)';
    OUTPUT WHEN heart % NOTFOUND;
    END LOOP;
    END;
    /


    I compile the above proc and get

    PLS-00435: without LINKING DML statement to BULK cannot be used

    the reason why I put in run is immediate because the my_stg table does not exist, it is created on the fly

    Maybe

    INSERT INTO my_stg (myid, mykey, id_seq)
    VALUES (rec1(i), rec2(i). sequence.nextval);
    

    Concerning

    Etbin

  • GETTING AN ERROR - slider 'P_REFCUR' cannot be used in the OPEN dynamic SQL stat

    DECLARE
    create or replace procedure partial_single (p_fileid in NUMBER, p_filename IN VARCHAR2 (2000), p_temptablename IN VARCHAR2 (2000), p_temppartialtablename IN VARCHAR2 (2000), p_retval ON the NUMBER)
    --)

    p_fileid NUMBER;
    p_filename VARCHAR2 (2000);
    p_temptablename VARCHAR2 (2000);
    p_temppartialtablename VARCHAR2 (2000);
    p_retval NUMBER;
    p_refcur types_pkg.return_cur;
    v_strquery varchar2 (4000);

    BEGIN

    p_fileid: = 5080;
    p_filename: = "TAGSUR1HM2011013111160838654.000019265";
    -p_temptablename: = "TEMP_RECORDS_MED_0004";
    p_temptablename: = 'TEMP_RECORDS_MED_DATE ';
    p_temppartialtablename: = 'TEMP_MED_PARTIAL_RECORDS_0002 ';
    p_retval: = 0;


    v_strquery: = 'SELECT imsi, connectedcallingnumber, callstart MIN (calleventstarttimestamp), SUM (calleventduration), MAX (sequence_number) sequencenumber, msisdn, max (callreleasetime) callreleasetime period';
    v_strquery: = v_strquery | ' A ' | p_temppartialtablename | ' GROUP BY connectedcallingnumber, imsi, msisdn';

    OPEN p_refcur - GETTING AN ERROR - slider 'P_REFCUR' cannot be used in a dynamic OPEN SQL statement
    FOR v_strquery;

    FOR CC IN (SELECT imsi,
    connectedcallingnumber,
    Callstart MIN (calleventstarttimestamp),
    Duration of the SUM (calleventduration),
    SequenceNumber MAX (sequence_number),
    MSISDN,
    Max (callreleasetime) callreleasetime
    OF TEMP_MED_PARTIAL_RECORDS_0002
    GROUP BY connectedcallingnumber, imsi, msisdn)

    LOOP

    UPDATE TEMP_RECORDS_MED_DATE
    SET calleventstarttimestamp = cc.callstart,
    calleventduration = calleventduration + cc.duration
    WHERE connectedcallingnumber = cc.connectedcallingnumber
    AND imsi = cc.imsi
    AND sequencenumber = cc.sequencenumber + 1
    AND msisdn = cc.msisdn
    AND calleventstarttimestamp = cc.callreleasetime;


    IF SQL % ROWCOUNT > 0
    THEN
    UPDATE TEMP_MED_PARTIAL_RECORDS_0002
    SET isprocessed = 1
    WHERE connectedcallingnumber = cc.connectedcallingnumber
    AND imsi = cc.imsi
    AND msisdn = cc.msisdn;
    - AND callreleasetime = cc.callreleasetime;

    ON THE OTHER

    UPDATE TEMP_MED_PARTIAL_RECORDS_0002
    SET calleventduration = calleventduration + cc.duration
    IMSI WHERE = cc.imsi
    AND msisdn = cc.msisdn
    AND callreleasetime = cc.callreleasetime
    AND calleventduration! = cc.duration;


    END IF;

    END LOOP;


    REMOVE FROM TEMP_MED_PARTIAL_RECORDS_0002
    WHERE isprocessed = 1;


    p_retval: = 0;

    -VALIDATION;
    / * EXCEPTION
    WHILE OTHERS
    THEN
    -RESTORATION;
    p_retval: = 1;
    p3_errorlog ("partial" p_fileid, SQLERRM, |) ':' || p_filename);
    COMMIT;
    */
    END;

    Is - what your refcursor has a return type? In this case you can not open it with dynamic SQL. Change the Refcursor as a weakly typed cursor and give it a try.

  • Tables created in a stored procedure cannot be used with dynamic SQL? The impact?

    There is a thread on the forum which explains how to create tables within a stored procedure (How to create a table in a stored procedure , however, it does create a table as such, but not how to use it (insert, select, update, etc.) the table in the stored procedure.) Looking around and in the light of the tests, it seems that you need to use dynamic SQL statements to execute ddl in a stored procedure in Oracle DB. In addition, it also seems that you cannot use dynamic SQL statements for reuse (insert, select, update, etc.) the table that was created in the stored procedure? Is this really the case?

    If this is the case, I am afraid that if tables cannot be 'created and used"in a stored procedure using the dynamic SQL, as is the case with most of the servers of DB dynamic SQL is not a part of the implementation plan and, therefore, is quite expensive (slow). This is the case with Oracle, and if yes what is the performance impact? (Apparently, with Informix, yield loss is about 3 - 4 times, MS SQL - 4 - 5 times and so on).

    In summary, tables created within a stored procedure cannot be 'used' with dynamic SQL, and if so, what is the impact of performance as such?

    Thank you and best regards,
    Amedeo.

    Published by: AGF on March 17, 2009 10:51

    AGF says:
    Hi, Frank.

    Thank you for your response. I understand that the dynamic SQL is required in this context.

    Unfortunately, I am yet to discover "that seeks to" using temporary tables inside stored procedures. I'm helping a migration from MySQL to Oracle DB, and this was one of the dilemmas encountered. I'll post what is the attempt, when more.

    In Oracle, we use [global temporary Tables | http://www.psoug.org/reference/OLD/gtt.html?PHPSESSID=67b3adaeaf970906c5e037b23ed380c2] aka TWG these tables need only be created once everything like a normal table, but they act differently when they are used. The data inserted in TWG will be visible at the session that inserted data, allowing you to use the table for their own temporary needs while not collide with them of all sessions. The data of the TWG will be automatically deleted (if not deleted programmatically) when a) a commit is issued or b) the session ends according to the parameter that is used during the creation of the TWG. There is no real need in Oracle to create tables dynamically in code.

    I noticed that many people say that the "Creation of the tables within a stored procedure" is not a good idea, but nobody seems necessarily explain why? Think you could elaborate a little bit? Would be appreciated.

    The main reason is that when you come to compile PL/SQL code on the database, all explicit references to tables in the code must correspond to an existing table, otherwise a djab error will occur. This is necessary so that Oracle can validate the columns that are referenced, the data types of those columns etc.. These compilation controls are an important element to ensure that the compiled code is as error free as possible (there is no accounting for the logic of programmers though ;)).

    If you start to create tables dynamically in your PL/SQL code, so any time you want to reference this table you must ensure that you write your SQL queries dynamically too. Once you start doing this, then Oracle will not be able to validate your SQL syntax, check the types of data or SQL logic. This makes your code more difficult to write and harder to debug, because inevitably it contains errors. It also means that for example if you want to write a simple query to get that one out in a variable value (which would take a single line of SQL with static tables), you end up writing a dynamic slider all for her. Very heavy and very messy. You also get the situation in which, if you create tables dynamically in the code, you are also likely to drop tables dynamically in code. If it is a fixed table name, then in an environment multi-user, you get in a mess well when different user sessions are trying to determine if the table exists already or is the last one to use so they can drop etc. What headache! If you create tables with table names, then variable Dynamics not only make you a lot end up creating (and falling) of objects on the database, which can cause an overload on the update of the data dictionary, but how can ensure you that you clean the tables, if your code has an exception any. Indeed, you'll find yourself with redundant tables lying around on your database, may contain sensitive data that should be removed.

    With the TWG, you have none of these issues.

    Also, what is the impact on the performance of the dynamic SQL statements in Oracle? I read some contrasting opinions, some indicating that it is not a lot of difference between static SQL and SQL dynamic in more recent versions of Oracle DB (Re: why dynamic sql is slower than static sql is this true?)

    When the query runs on the database, there will be no difference in performance because it is just a request for enforcement in the SQL engine. Performance problems may occur if your dynamic query is not binding variable in the query correctly (because this would cause difficult analysis of the query rather than sweet), and also the extra time, to dynamically write the query running.

    Another risk of dynamic query is SQL injection which may result in a security risk on the database.

    Good programming will have little need for the tables of dynamically created dynamically or SQL.

  • Case function can be used as a parameter when calling a procedure, please advise...

    Case function can be used as a parameter when calling a procedure, please notify

    The daily procedure is called with the parameter 3 following one of the parameters using a function box between them as shown below.

    Daily_Ins (c1.p_mtrid, c1.p_UOM CASE WHEN "KWH" THEN 1 ELSIF 'KW' THEN 2 END, v_dateHold);

    In my opinion, using decode is illegal, so I think that I cannot say something like :

    Daily_Ins (c1.p_mtrid, ( decode c1.p_UOM, "KWH", 1 'KW', 2), v_dateHold);

    I think I just found something on the net

    SQL > DECLARE

    2 wages NUMBER: = 20000;

    3 employee_id NUMBER: 36325 =;

    4

    5 PROCEDURE give_bonus (emp_id in NUMBER, bonus_amt number) IS

    6 BEGIN

    7 DBMS_OUTPUT. Put_line (emp_id);

    8 DBMS_OUTPUT. Put_line (bonus_amt);

    9 END;

    10

    BEGIN 11

    12 give_bonus (employe_id,

    13 CASES

    14 salary when > = 10000 AND salary<=20000 then="">

    15. WHAT salary > 20000 AND salary<= 40000="" then="">

    16. WHAT > 40000 salary THEN 500

    17 0 OTHERWISE

    18 END);

    END 19;

    20.

    PL/SQL procedure successfully completed.

  • How to use Pl/Sql in Discoverer report

    Hello world

    Would you be able to provide a flow of work and guidance how to use the sql function in right of discoverer of the creation of the function by using PLSQL Developer.

    (I'm new to Oracle environment... Prev worked as analyst with Microsoft Access... takes PL/Sql class at school a few years ago)

    We use Discoverer Desktop.

    (a) dba just email for permission to create the pl/sql function.
    (b) recently completed Discoverer Administrator installed on my pc.

    can you pls add to the list:

    c)....

    d)....

    etc. ?

    TX for your help, sandra

    Hi sandra,.

    Its been ages've seen it here. How are you??

    (c) creation of the function by using PLSQL developer

    go through this link of creating functions

    [http://www.techonthenet.com/oracle/functions.php]

    (d) recording the discoverer function

    GoTo Admin--> Tools--> Register PL / SQL--> functions import... Select your function and say apply

    For more information about the functions, you can go through the tutorials

    [http://download.oracle.com/docs/html/A90881_02/calculat.htm#1006629]

    Hope this helps you.

    Best wishes
    Murielle.

  • Why this flash drive cannot be used for loan boost in windows 7?

    I have a flash drive 8 GB Kingston which is useless, but functional. I decided to use it to boost lending. So, when I go to ready boost in windows 7, it says this drive cannot be used as ready boost I've tried several times but the same answer. When I try to use it as ready boost preview of consumer windows it says OK. I have set up as ready boost. I also format and then try but same answer in windows 7. How can I use this disk as ready boost in windows 7?

    Sometimes the reader is not fast enough for Readyboost. BTW: How much memory you have in your PC? You can even no need for ReadyBoost.

    But, to force Windows to use ReadyBoost (even with a slow flash drive): http://www.mstechpages.com/2010/10/12/force-readyboost-on-a-usb-device/

  • When I compile skied lib for blackberry 10, I encountered an error "A7 cannot be used in asm here."

    To draw text in the cascades, I found this article:

    http://supportforums.BlackBerry.com/T5/tkb/articleprintpage/tkb-ID/Cascades@tkb/article-ID/14

    but when I compile the lib skied, I encountered this error, no idea about it, can anyone help?

    QCC o src\opts\SkBlitRow_opts_arm.o... \src\opts\SkBlitRow_opts_arm.cpp-V4.6.3, gcc_ntoarmv7le_cpp-no-w1-shared - IF: / bbdev/bbndk/target_10_0_9_386/qnx6/usr/include/freetype2 - IF: \bbdev\bb10Apps\blackberry-Skia\gpu\include-IF: \bbdev\bb10Apps\blackberry-Skia\include\config-IF: \bbdev\bb10Apps\blackberry-Skia\include\core-IF: \bbdev\bb10Apps\blackberry-Skia\include\effects-IF: \bbdev\bb10Apps\blackberry-Skia\include\gpu-IF: \bbdev\bb10Apps\blackberry-Skia\include\images-IF: \bbdev\bb10Apps\blackberry-Skia\include\utils-IF : \bbdev\bb10Apps\blackberry-Skia\src\core-IF: / bbdev, bbndk, target_10_0_9_386, qnx6 /... / goal-override/usr/include - D_FORTIFY_SOURCE = 2 - Dgrskia_EXPORTS-D_FILE_OFFSET_BITS = 64-D_LARGEFILE64_SOURCE-DSKIA_IMPLEMENTATION = 1 - DGR_IMPLEMENTATION = 1 - DGR_QNX_BUILD = 1 - DUSE_GANESH = 1 - /DDEBUG - c g - fstack-protector-all - fstack-protector - fno-strict-aliasing - fno-rtti - fpic - fvisibility = hidden - mtune = cortex-a9 - mfpu = vfpv3-lang-c ++
    .. \src\opts\SkBlitRow_opts_arm.cpp: function ' void S32A_Opaque_BlitRow32_arm (SkPMColor *, SkPMColor const *, int, U8CPU)':
    .. \src\opts\SkBlitRow_opts_arm.cpp:655:1: error: A7 cannot be used in asm here
    CC: F:/bbdev/bbndk/host_10_0_9_52/win32/x86/usr/lib/gcc/arm-unknown-nto-qnx8.0.0eabi/4.6.3/cc1plus caught signal 1
    Build error has occurred, build is stopped
    Time consumed: 193984 ms.

    I found the solution.  Add the option of compilation of QCC:

    -fomit-frame-pointer

    now I get him skied lib for blackberry 10

  • The activation server determined that the specified product key cannot be used.

    (windows 7 Professional) product key, I get from MSDN, through my college
    the key has been used first in my office and I've activated, it
    later, I formatted my desktop computer and install w7 in my laptop with the above product key
    so I find the product key will be impossible to activate windows

    Here are the details of the error:
    ---------------------------
    Error details
    ---------------------------
    The following information was found for this error:

    Code:

    0xC004C008

    Description:

    The activation server determined that the specified product key cannot be used.

    ---------------------------
    Ok
    ---------------------------

    pls help >
    THX in advance

    Hello

    Since you have already activated this product key, the server displays the key as being in use. Simply call the Activation Center and activate manually settle.

    1. press the Windows Logo key + R. This will bring up the run dialog box.

    2. in the Open: box, type slui 4 and press OK. This starts the manual activation wizard.

    3 select your country from the drop down and click Next.

    4. the wizard displays a toll-free telephone number. Leave the wizard open on the computer and call this phone number.

    You will receive a few saved options. Select the option to speak to a representative.

    The representative will manually activate this system for you.

    Let us know if you mhave more problems

    Ronnie Vernon MVP

  • On Windows 7 get the error message "the product key you entered cannot be used to activate Windows on this computer."

    Hi, I have original windows7 and I tried to reinstall, but have a problem. When I try to activate I get a message "the product key you entered cannot be used to activate Windows on this computer. pls help me...

    Product ID: 004626-068-2570142-86162

    The ID of the product - 068 - indicates a not for resale MSDN account. If you are not the account holder and you bought it in a box at retail, the box and its contents is counterfeit. Request an immediate refund from the seller

    For more information, see this:

    http://social.Microsoft.com/forums/en-us/genuinewindows7/thread/a2444f34-0AFF-4f29-a8ac-67e28b0c0285

    And this:

    http://social.Microsoft.com/forums/en-us/genuinewindows7/thread/309bb621-92d5-43d6-98c1-2bb51b35607f

    To see how these counterfeits are more, see:

    http://www.YouTube.com/watch?v=hzqNNiOM0cs

    You can buy a legitimate windows from a legitimate retailer.

  • Any idea which function Essbase or a combination of function can be used to get the level zero members of a list of members.

    Any idea which function Essbase or a combination of function can be used to get the level zero members of a list of members. I know that @RELATIVE or @DESCENDANTS cannot be used.

    If you want to fix on all level 0 members in a member set, then maybe @ILDESCENDANTS will work for you.  Something like: @ILDESCENDANTS (@LIST (members), 0)

  • using the function - how to use the values of the input variables on the table select statement names

    Hello community, I have a problem when creating a function. The purpose of this function is to check the table of weather gave yesterday or not. We must check this on different tables on different sachems. We are creating a function with input variables.

    CREATE OR REPLACE FUNCTION IN_SCHEMA.IS_YDAYDATA_TO_TABLE

    (

    in_schema IN VARCHAR2,

    in_tablename IN VARCHAR2,

    in_datefield IN VARCHAR2,

    )

    RETURNS INTEGER

    AS

    -Declaring variables

    v_is_true INTEGER.

    BEGIN

    SELECT

    CASE

    WHEN MAX (in_datefield) = TRUNC(SYSDATE-1)

    THEN 1

    ON THE OTHER

    0

    END

    IN

    v_is_true

    Of

    in_schema.in_tablename

    ;

    RETURN v_is_true;

    END;

    /

    When creating, I got error: [error] ORA-00942 (44:19): PL/SQL: ORA-00942: table or view does not exist

    How to use the values of the input variables on the table select statement names?

    Hello

    Here's a way you can use dynamic SQL statements for this task:

    CREATE OR REPLACE FUNCTION IS_YDAYDATA_TO_TABLE

    (

    in_schema IN VARCHAR2,

    in_tablename IN VARCHAR2,

    in_datefield IN VARCHAR2,

    in_first_date DATE DEFAULT SYSDATE - 1,.

    in_last_date DATE by DEFAULT NULL

    )

    RETURNS INTEGER

    AS

    -IS_YDAYDATA_TO_TABLE returns 1 if in_schema.in_tablename.in_datefield

    -contains all the dates in the in_first_date of the range through included in_last_date

    - and it returns 0 if there is no such lines.

    -If in_last_date is omitted, the search only the data on in_first_date.

    -If in_first_date is omitted, it defaults to yesterday.

    -Time parts of the in_first_date and in_last_date are ignored.

    -Declaring variables

    sql_txt VARCHAR2 (1000);

    v_is_true INTEGER.

    BEGIN

    sql_txt: = 'SELECT COUNT (*).

    || 'FROM ' | in_schema | '.' || in_tablename

    || 'WHERE ' | in_datefield | ' > =: d1'

    || «AND» | in_datefield | '< >

    || 'AND ROWNUM = 1';

    dbms_output.put_line (sql_txt |) '= sql_txt in IS_YDAYDATA_TO_TABLE");  -For debugging

    Sql_txt EXECUTE IMMEDIATE

    IN v_is_true

    With the HELP of TRUNC (in_first_date) - d1

    TRUNC (NVL (in_last_date

    in_first_date

    )

    ) + 1                -- d2

    ;

    RETURN v_is_true;

    END is_ydaydata_to_table;

    /

    DISPLAY ERRORS

    If you must use dynamic SQL statements, put all the SQL statement in a single string variable, such as sql_txt in the example above.  In this way, you can easily see exactly what will be executed.  Comment out the call to dbms_output under test is completed.

    Try to write functions that will address not only the question that you have now, but similar questions that you may have in the future.  For example, now that interest you only to the verification of the data of yesterday, but later, you might want to check another day or range of days.  The above function combines the convenience of a function simple (looks like yesterday data if you don't tell him otherwise) with the power of a more complex function (you can use the same function to check any day or range of days).

  • Parse the JSON using PL/SQL string

    I created a script that reads data from the Mobile App DB (which is based on MongoDB) of Oracle SQL Developer. The result is the string JSON stored in l_response_text VARCHAR2 (32767);

    The string has the format such as:


    [{"Postcode":"47100","OutletCode":"128039251","MobileNumber":"0123071303","_createdAt":"2014-11-10 06:12:49.837","_updatedAt":"2014-11-10 06:12:49.837"}, {"Postcode":"32100","OutletCode":"118034251", ..... ]
    
    
    
    
    

    However, I need to analyze this l_response_text such that each table will in his column in a table called appery_test. appery_test table has the same number of columns pairs JSON and in the same order (e.g. name of the first column is 'postal Code')

    I searched and I found most of the results on the analysis of the Oracle in JSON table and not the other way around. I found, however, that link which is somewhat similar to my problem. However, the library suggested in the answer doesn't have an example on how to use it to insert JSON into conventional table using PL/SQL.

    N.B.: I use g 11 and not 12 c. If the functions built by are not available for me.

    Thank you very much

    Sorry, I am a novice in this area too.

    However, it worked for me:

    declare

    l_list json_list;

    l_data CLOB;

    Code postal clob;

    l_val json_value;

    Start

    -json data recovery

    Select the data in l_data from jsons where id = 1;

    l_list: = json_list (l_data);

    I'm looping 1.l_list.count

    l_val: = json_ext.get_json_value (json (l_list.get (i)), 'Postcode');

    DBMS_LOB.CREATETEMPORARY (zip, true, 2);

    json_value.get_string (l_val, postal code);

    -Put some things

    dbms_output.put_line (DBMS_LOB. GetLength (Postcode));

    dbms_output.put_line (dbms_lob.substr (postal code, 20, 1));

    DBMS_LOB.freeTemporary (Postcode);

    end loop;

    end;

    47328

    9J / / 4AAQSkZJRgABAQAA

    Added dbms_lob.freetemporary (postcode);

Maybe you are looking for

  • How to make boxes to the letters for my alias iCloud in Mac Mail

    How to make mailboxes mailbox for my alias iCloud in Mac Mail? I have just set up my e-mail address of iCloud for the first time.  I had an Apple account for many years, but had not hitherto iCloud email address.  After that, Mac Mail automatically c

  • Photos app does not save the changes, impossible to edit photos without using other applications

    'Photos' of photo editing features does not work because it is impossible to save the changes. Photos can be edited as usual, but trying to save the changes that the photo is reinstated to the State of origin regardless of changes. There is no error

  • Flatten the two (or more) transparent PNG images (32-bit)

    Hello How to flatten two (or more) transparent PNG (32-bit) images. The result must also be a transparent PNG (32 bit).

  • Scanning from OfficeJet 8500

    My OfficeJet 8500 has stopped printing.  After removing the ink cartridges, I tried to use it as a scanner only.  The screen of the printer has a message that the ink cartridges are missing.  The all-in-one will not be replied to attempts to exceed t

  • Without appearing here no more

    Like many other people posting today, I have no sound coming from my speakers or headphones.  I can get sound from HDMI output.  An update from HP has been installed the last time I used the computer. I have a Pavilion DV7 running Windows 7 64-bit.