Create the table in the return procedure ON gets PLS 00306

I would like to know the best way to do it. I am writing a procedure to create a table if it exists not as a select of.
All I want to do is return a code completion to the calling program. My error is the wrong number of arguments in the call to create_tab,
but all I want to do is return the completion code. PLS - 00306 wrong number or types of arguments in the call to Create_tab

I wonder if the experts out there have a better implementation or suggestions for it.

Thank you.

Create or replace procedure create_tab (pstatus NUMBER) is

sqltextheader varchar2 (200);
sqltextfrom varchar2 (200);
sqltextwhere varchar2 (200);
sqltextdrop varchar2 (200);
Whole CNT;
p_err COMP. = 0 ;

Start

Select count (*) in the cnt from user_tables where table_name = 'TESTA. "

DBMS_OUTPUT. Put_line ('cnt value is' | cnt);

If (cnt = 1)
then
sqltextdrop: = 'drop testa table ";
immediately run sqltextdrop;
DBMS_OUTPUT. Put_line ('Table testa fell ');

sqltextheader: = 'crΘer testa table as ";
sqltextfrom: = ' select * from ssg_test';
sqltextwhere: = ' where col_one > sysdate ";
run immediately sqltextheader | '' || sqltextfrom: "| sqltextwhere;
commit;

pstatus: = pstatus + 1

end if;

If (cnt = 0)

then

sqltextheader: = 'crΘer testa table as ";
sqltextfrom: = ' select * from ssg_test';
sqltextwhere: = ' where col_one > sysdate ";
run immediately sqltextheader | '' || sqltextfrom: "| sqltextwhere;
commit;

pstatus: = pstatus + 1

exception
while others then
p_created: = pcreated + 2;
DBMS_OUTPUT. Put_line ('error raised is value' | pcreated_;)
end create_tab;
/

sgonos wrote:
This effort is just to make code testing and does not come into production. So I need something
to make a return code to the calling program.

It's well :)

So, Yes, the code is consistent, but I get an error on the number of arguments. I am writing this
procedure for a developer so I don't know exactly its code, other than what he wants me to a return code
for him.

Can you show us how you (or 'the developer') call this program?

If you have examples of this? Where I am confused in the entrance and exit of the parameters for the procedure...

Generally, if you want to return a single value of a routine, you use a FUNCTION. But you would need to talk to 'the developer' to see what they expect it to come back... and why.

If I only returns a code of State STATUS OF THE number then why oracle gives me error on the
wrong number or type of variables. If I set the STATUS in the procedure, then I get an error
variables in double. Where get set STATE?

I don't know, I need to see an example of how you call it, but here's an example that you can run using SQLPLUS.

Create or replace procedure create_tab
(
  pstatus OUT number
)
authid CURRENT_USER
is

  sqltextheader varchar2(200);
  sqltextfrom   varchar2(200);
  sqltextwhere  varchar2(200);
  cnt           integer;

begin

  select
    count(*)
  into
    cnt
  from user_tables
  where table_name ='TESTA';

  DBMS_OUTPUT.PUT_LINE ('cnt value is ' || cnt);

  if cnt = 1
  then
    execute immediate 'drop table testa';
    DBMS_OUTPUT.PUT_LINE('Table testa is dropped');
  end if;

  sqltextheader := ' create table testa as   ';
  sqltextfrom   := ' select * from ssg_test  ';
  sqltextwhere  := ' where col_one > sysdate ';
  dbms_output.put_line(sqltextheader || sqltextfrom || sqltextwhere );
  execute immediate sqltextheader || sqltextfrom || sqltextwhere ;
  pstatus := 1;

end create_tab;
/ 

variable x number;
exec create_tab(:x);
print :x

I added an AUTHID CURRENT_USER in the procedure. That means that this code executes with the privileges of the user running it, if this isn't something you are willing to have (the code runs with the permissions of the owner of the procedure otherwise)... just remove it.

Tags: Database

Similar Questions

  • Create the stored procedure with the table from another throw diagram PLS-00201

    Oracle 10g. I'm new on procedures, so maybe I'm missing something obvious.

    The ABC schema owner has table T2001_WRITEOFF. The SYSDBAs given SIUD Some_Update_Role and granted this role to developer user IJK. IJK user then created a private synonym T2001_WRITEOFF for ABC. T2001_WRITEOFF. It worked with the usual SQL DML commands.

    When I try to create a simple procedure, it throws PLS-00201 identifier "T2001_WRITEOFF" must be declared and the points of the 2nd line.

    create or replace procedure woof1(
      fooname
    in T2001_WRITEOFF.territory%TYPE,  <=== error points here
      bardesc
    IN T2001_WRITEOFF.ind_batch_submit%TYPE) IS
    BEGIN
      
    INSERT into T2001_WRITEOFF
      
    VALUES ( fooname, bardesc);
    END woof1;
    /


    What I am doing wrong?


    Thank you

    JimR


    Grant the necessary rights directly to the user (not through a role):

    http://asktom.Oracle.com/pls/asktom/asktom.download_file?p_file=6551289900368934430

  • Cannot create the plsql procedure, fails at the cursor

    He was a working procedure that would take ID and then copy the data from the source to the destination parameter parameter. Now I would like to have the NAME as a parameter, I changed the code to accommodate the new settings. But I'm not able to create the procedure. I get error 3-CURSOR (in bold red). I would really appreciate if someone can take a look and let me know what the problem is.

    Thanks in advance

    3 errors

    1 PLS-00103: encountered the symbol "CUR_V_HSP_COLUMN_DETAIL" during the expected in the following way:

    := . ( @ % ;

    The symbol ': = ' was replaced by 'CUR_V_HSP_COLUMN_DETAIL' continue.

    2 PLS-00103: encountered the symbol "NUMBER" when expecting one of the following conditions:

    (

    The symbol "(" was substituted for "NUMBER" to continue.

    3 PLS-00103: encountered the symbol "NUMBER" when expecting one of the following conditions:

    (

    CREATE or REPLACE procedure EPM_PLAN_PLANSAMP. Copy_Details_test1 - Arguments

    ( IN VARCHAR2, HSP_object in_From_Version_Name.) Object_name - Version of

    in_From_Scenario_Name IN VARCHAR2, HSP_object. Object_name - scenarios of

    in_From_Year_Name IN VARCHAR2, HSP_object. Object_name - year from

    in_To_Version_Name IN VARCHAR2, HSP_object. Object_name - Version to

    in_To_Scenario_name IN VARCHAR2, HSP_object. Object_name - scenarios

    in_To_Year_Name IN VARCHAR2 - HSP_object. Object_name - year to

    )

    IS

    number of v_From_Object_Id; -Version of

    number of s_From_Object_Id; -Scenarios of

    number of y_From_Object_Id; -The year of

    number of v_To_Object_Id; -Version to

    number of s_To_Object_Id; -Scenarios to

    number of y_To_Object_Id; -The year to

    BEGIN

    Select object_id in v_From_Object_Id

    of hsp_object

    where type_objet = 35

    and object_name = in_from_version_name;

    Select object_id in s_From_Object_Id

    of hsp_object

    where type_objet = 31

    and object_name = in_from_scenario_name;

    Select object_id in y_From_Object_Id

    of hsp_object

    where type_objet = 38

    and object_name = in_from_year_name;

    Select object_id in v_To_Object_Id

    of hsp_object

    where type_objet = 35

    and object_name = in_to_version_name;

    Select object_id in s_To_Object_Id

    of hsp_object

    where type_objet = 31

    and object_name = in_to_scenario_name;

    Select object_id in y_To_Object_Id

    of hsp_object

    where type_objet = 38

    and object_name = in_to_year_name;

    -Select Details of support for the current Version

    CURSOR Cur_V_HSP_COLUMN_DETAIL (cV_From_Object_Id in NUMBER, cS_From_Object_Id number) IS

    Select DETAIL_ID in the EPM_PLAN_PLANSAMP. HSP_COLUMN_DETAIL where DIM5 = cV_From_Object_Id AND DIM1 = cS_From_Object_Id;

    li_DETAIL_ID NUMBER;

    Li_Next_DETAIL_ID NUMBER;

    FETCH_STATUS NUMBER: = 0;

    v_step_name varchar2 (200);

    v_rec_cnt number: = 0;

    number of v_cnt;

    v_err varchar2 (2000);

    -----------------------------------------Begin Copy Version ---------------------------

    BEGIN

    -Removed next version if already exists

    v_step_name: = 'delete the HSP_COLUMN_DETAIL_ITEM ";

    Remove from HSP_COLUMN_DETAIL_ITEM

    Where DETAIL_ID in (Select DETAIL_ID from HSP_COLUMN_DETAIL

    Where = v_To_Object_Id AND DIM1-DIM5 = s_To_Object_Id);

    v_cnt: = number of lines sql %;

    insert into t_copy_supporting_dtls_log values (v_step_name, v_cnt, 1, sysdate, 'success');

    v_step_name: = 'delete the HSP_COLUMN_DETAIL ";

    Remove from HSP_COLUMN_DETAIL

    where = v_To_Object_Id AND DIM1-DIM5 = s_To_Object_Id;

    v_cnt: = number of lines sql %;

    insert into t_copy_supporting_dtls_log values (v_step_name, v_cnt, 1, sysdate, 'success');

    Open Cur_V_HSP_COLUMN_DETAIL (v_From_Object_Id, s_From_Object_Id);

    v_step_name: = "Insert";

    LOOP

    Look FOR Cur_V_HSP_COLUMN_DETAIL IN li_DETAIL_ID;

    WHEN the OUTPUT Cur_V_HSP_COLUMN_DETAIL % NOTFOUND;

    -Find the next detail_id

    Select Max (DETAIL_ID) + 1 IN HSP_COLUMN_DETAIL Li_Next_DETAIL_ID;

    -Insert in the Table HSP_COLUMN_DETAIL

    Insert into HSP_COLUMN_DETAIL (DETAIL_ID, PLAN_TYPE, DIM1, DIM2, DIM3, DIM4, DIM5, 6,

    DIM7, DIM8, DIM9, DIM10, DIM11, DIM12, DIM13, DIM14, DIM15,

    DIM16, DIM17, DIM18, DIM19, DIM20)

    Select Li_Next_DETAIL_ID, PLAN_TYPE, S_To_Object_Id, DIM2, DIM3, DIM4, V_To_Object_Id, 6.

    DIM7, DIM8, DIM9, DIM10, DIM11, DIM12, DIM13, DIM14, DIM15,

    DIM16, DIM18, DIM19, DIM17, DIM20

    Of HSP_COLUMN_DETAIL

    Where DETAIL_ID = li_DETAIL_ID;

    v_rec_cnt: = v_rec_cnt + sql rowcount %;

    -Insert in the Table HSP_COLUMN_DETAIL_ITEM

    Insert into HSP_COLUMN_DETAIL_ITEM (DETAIL_ID, VALUE, POSITION, GENERATION, OPERATOR, LABEL)

    Select VALUE, POSITION, GENERATION, OPERATOR, Li_Next_DETAIL_ID, LABEL

    From HSP_COLUMN_DETAIL_ITEM where DETAIL_ID = li_DETAIL_ID;

    v_rec_cnt: = v_rec_cnt + sql rowcount %;

    END LOOP;

    Close Cur_V_HSP_COLUMN_DETAIL;

    insert into t_copy_supporting_dtls_log values (v_step_name, v_rec_cnt, 1, sysdate, 'success');

    commit;

    exception when others then

    Rollback;

    v_err: = substr (sqlerrm, 1, 2000);

    insert into t_copy_supporting_dtls_log values (v_step_name, 0, -1, v_err, sysdate);

    commit;

    END;

    END;

    /

    You DECLARE the cursor before using it.

  • Failed to create the stored procedure with the object as a parameter

    Hello

    No idea how to create procedures to the current data stored in SQLFire, try to run the command prompt "sqlf" per call "create_proc.sql" as give below error below

    C:\SQLFire10Beta>sqlf
    sqlf version 10.4
    sqlf> connect client 'localhost:1527';
    sqlf> run 'create_proc.sql';
    sqlf> CREATE PROCEDURE INSURANCE.SEARCHCUSTOMER (IN CUST OBJECT) DYNAMIC RESULT SETS 1 LANGUAGE JAVA PARAMETER STYLE JAVA READS SQ
    L DATA EXTERNAL NAME com.xxx.xxx.sqlfire.dao.CustomerSearchProcedure.searchCustomer;
    ERROR 42X01: Syntax error: Encountered "" at line 1, column 47.
    Caused by: SqlException: Syntax error: Encountered "" at line 1, column 47.
            at com.vmware.sqlfire.internal.client.am.Statement.completeSqlca(Statement.java:1838)
    sqlf> sqlf> 


    and I created a class Java as described below:

    public class CustomerSearchProcedure {
     
     public static void searchCustomer (BaseDTO[] customers, ResultSet[] outResults,
       ProcedureExecutionContext context) throws SQLException {
      BaseDTO searchCriteria = customers[0];
      StringBuilder sql = new StringBuilder();
      sql.append("SELECT * FROM INSURANCE.CUSTOMERS WHERE CUST_NAME LIKE '"+searchCriteria.getCustName().trim() + "%'");
      
      Connection cxn = context.getConnection();
      Statement stmt = cxn.createStatement();
      ResultSet rs = stmt.executeQuery(sql.toString());
      outResults[0] = rs;
     } //END OF METHOD
    }


    This procedure is called class using the class StoredProcedure Spring DAO

    You can let me know why am not able to create the procedure?

    FYI, pots can also can be dynamically installed in the system by using the SYS. Table client-side JARS to transport the jar bytes rather than by requiring that the pot be accessible side Server (http://pubs.vmware.com/vfabric5/index.jsp?topic=/com.vmware.vfabric.sqlfire.1.0/deploy_guide/Topics/sysjars_install.html)

  • Unable to create the external procedure Oracle to run host commands

    Trying to follow this article
    http://timarcher.com/node/9
    His associates to
    Oracle external procedure to run commands from the host
    measures
    (1) mkdir-p/u01/app/usfapp/oracle_external_procs/oracle_host
    2)
    Author suggests to create a file
    but the header file is missing from the first line... may be not not sure... it's < stdio.h >
    create a file named oracle_host.c. The contents of this file will be:

    #include

    int RunCmd(char *cmd)
    {
    (System (cmd)) return;
    }


    (4) create the file called makefile. The contents of this file will be:

    ORACLE_HOST: oracle_host.o
    GCC-shared o oracle_host.so oracle_host.o

    $ cat makefile
    ORACLE_HOST: oracle_host.o
    GCC-shared o oracle_host.so oracle_host.o

    5)
    Now, run the make command
    The output on my server looks like:

    [u01/app/usfapp/oracle_external_procs/oracle_host]
    Banner@usfbannerte [TRNG] > make
    GCC-shared o oracle_host.so oracle_host.o

    here, I stuck... [Not able to run this step
    ] $ make
    GCC-shared o oracle_host.so oracle_host.o
    / usr/bin/LD: oracle_host.o: relocation R_X86_64_32 against 'a local symbol' can not be used when an object shared; Recompile with - fPIC
    ORACLE_HOST.o: could not read symbols: bad value
    collect2: ld returned 1 exit status
    make: * [oracle_host] error 1


    One has an idea of what went wrong

    Other links related to this is more welcomed.

    Please suggest...

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:934029542973

  • How to create a table in a stored procedure

    Please help me to answer the following question...

    How to create a table inside the stored procedure... I want a detailed explanation... Please help me

    Please see this link:
    http://tinyurl.com/cmq5vo

  • When you try to create the simple volume, I get "There is not enough available space on the disks to complete this operation." Even when there is obviously a lot of space.

    I just installed Windows 7 Professional in the last hour and was not able to create this partition during the installation.  Now that I'm in disk management.  It's showing I 73,24 GB of free space.  What I'm trying to do in the end, is to combine this with a partition already created.  One thing I find strange is anytime I go into "new simple volume" it tells me that the maximum space in MB is 74997 when the free space on the graph shows me only 73,24 GB.  I tried to create the size of the volume to 73000 MB and have also tried 10000MB and get to every time the same mistake!  "There is not enough available space on the disks to complete this operation."  What can I do to fix this?

    Your best bet is a third party partition manager.

    With the tools of Windows 7, you can only shrink and extend partitions, apart from the creation and deletion of them.

    Disk manufacturers quote their sizes of disc in decimal format. Windows Go are 2 ^ 10 or 1024 decimal MB. Then 74997/1024 is 73,24 GB.

  • Can't get the procedure to update - PLS - 00306:Wrong number or types of arguments

    I'm in a situation where I think that despite the correct number of parameters by the way my local procedure (which has been "forward declarations" in addition to logical writing for her; I use all this in a package) fails to compile in SQL * faster due to the error PLS - 00306:Wrong number or types of arguments in the call to P_SENDMAIL.


    I'm passing 5 parameters in the area of forward declarations and also in the logic/header inside in addition to calling the procedure in the package. Can one of you help mewith this and tell me where exactly the error might be. Here is the code:


    [code]

    -Local variable

    CRLF VARCHAR2 (2) CONSTANT: = CHR (13) | CHR (10);

    -- --------------------------------------------------------------------------------

    -FORWARD DECLARATIONS

    -- -----------------------------------------------------------------------------

    PROCEDURE p_sendmail (p_sender_email IN VARCHAR2,

    P_FROM IN VARCHAR2,

    p_to IN VARCHAR2,

    msg_subject IN VARCHAR2 DEFAULT NULL,

    p_msg_body IN LONG DEFAULT NULL);

    [/ code]


    The procedure itself:


    [code]


    PROCEDURE p_sendmail (p_sender_email IN VARCHAR2,

    P_FROM IN VARCHAR2,

    p_to IN VARCHAR2,

    msg_subject IN VARCHAR2 DEFAULT NULL,

    p_msg_body IN LONG DEFAULT NULL) is

    LONG v_to_list;

    LONG v_cc_list;

    LONG v_bcc_list;

    T_DATE VARCHAR2 (255) DEFAULT TO_CHAR(SYSDATE, 'DD MON YYYY HH24:MI:SS PM');

    g_mail_conn UTL_SMTP. CONNECTION;

    SMTP_HOST CONSTANT VARCHAR2 (256): ='smtp - abc.defg.ca';

    SMTP_PORT CONSTANT PLS_INTEGER: = 25;

    BEGIN

    g_mail_conn: = UTL_SMTP. OPEN_CONNECTION (SMTP_HOST, SMTP_PORT);

    UTL_SMTP. HELO (g_mail_conn, SMTP_HOST);

    UTL_SMTP.mail (g_mail_conn, p_sender_email);

    UTL_SMTP. RCPT (g_mail_conn, p_to);

    UTL_SMTP.open_data (g_mail_conn);

    UTL_SMTP.write_data (g_mail_conn, "|) CRLF);

    UTL_SMTP.write_data (g_mail_conn, p_msg_body);

    UTL_SMTP.close_data (g_mail_conn);

    UTL_SMTP. Quit (g_mail_conn);

    EXCEPTION

    WHEN utl_smtp.transient_error THEN

    Dbms_output.put_line ('TransientError: invalid operation in the service may not be available.) ") ;

    WHEN utl_smtp.permanent_error THEN

    Dbms_output.put_line (' permanent error: the entered email is invalid or recepients mailbox is full.) ») ;

    WHILE others THEN

    Dbms_output.put_line ('Unable to send an email' |') '|| SQLERRM);

    END p_sendmail;

    [/ code]

    Now by calling the procedure to send an email:

    [code]

    p_sendmail (p_sender_email = > ' [email protected]'-, send an E-mail to the donor )

    p_from = > ' ADS < [email protected] > ',

    p_to = > v_store_email_address,

    p_msg_subject = > 'anonymous user ',.

    p_msg_body = > 'thank you ' |

    CRLF.

    "Email confirms that we have received your promise |

    CRLF.

    CRLF.

    ' Name: '. v_full_name |

    CRLF.

    ' Temporary ID: ' | v_azbwccp_id |

    CRLF.

    "Reference number: ' |" MTID |

    CRLF.

    "Amount: ' | '. TO_NUMBER (campaign_desg_amt1) |

    CRLF.

    "Campaign: ' | '. campaign |

    CRLF.

    ' Description: ' | '. adbdesg_rec.adbdesg_name |

    CRLF.

    ' Type: ' | atvpldg_rec.atvpldg_desc |

    CRLF.

    ' Duration: ' | '. atvpdur_rec.atvpdur_desc |

    CRLF.

    "Frequency: ' | '. atvfreq_rec.atvfreq_desc |

    CRLF.

    "Start date: ' | '. bill_date2 |

    CRLF.

    CRLF.

    'Your commitment is processed.' |

    CRLF.

    "At the same time, if you want to change this transaction, please contact us.

    CRLF.

    CRLF.

    "Thank you for your support." |

    CRLF.

    CRLF.

    CRLF.

    CRLF.

    ' * This is an automated message system. Please, do not respond to this email. *** ') ;

    [/ code]


    I've also attached a screenshot of the error message below:

    ScreenHunter_15 Nov. 27 09.35.jpg

    Please help me if you can. I just can't understand the question.


    Thanks in advance

    Sandeep

    In the header of the procedure, I spent my parameter as msg_subject and during the call, he was p_msg_subject. The minute that I corrected the error, I was able to correctly compile the whole package body.

    The question can be now closed.

  • Create the jdbc datasource and get database connection

    Hi all

    How can I create a jdbc data source in Jdeveloper Version 11.1.1.0.1? In the previous version of Jdeveloper when I create new database connection using the database browser he created xxxx-data - sources.xml in the application directory. I used following code to get the database connection.

    Fitting out = null;
    Context ic = new world;
    DataSource ds = (DataSource) ic.lookup (dataSource);
    connection = ds.getConnection ();

    But this method does not work in this version of jdeveloper. It creates no data-xxxx - sources.xm in the application directory. Please give me a suggestion to create the jdbc data source and to get a database connection in this version.
    The previous version of JDeveloper using OC4J, but this version using Weblogic.

    Thank you
    Sujnan

    Published by: sujnan on March 25, 2009 23:09

    Also add the data source in the web.xml file.

    JDBC/OracleDS
    javax.sql.DataSource
    Container

    InitialContext initialContext = new InitialContext();
    DataSource ds = (DataSource)
    initialContext.lookup("java:comp/env/jdbc/OracleDS");
    java.sql.Connection connection = ds.getConnection();
    

    Published by: Billett on March 25, 2009 12:08

  • create the return address by default for outgoing messages

    Help, please!  I need to create a return for all my outgoing mail address... Windows Mail, Vista, Office 2007

    calwillno1,
    Thank you for visiting the Microsoft Answers community forum.

    What exactly do you mean by default return address?  If you are referring to your default e-mail address, there is an option as well Windows Mail and Outlook to set one of your default email addresses, if you have more than one.
    Where to set this option differs in Windows Mail and Outlook, but both would be under Tools accounts and settings or properties.
    In most cases, when you reply to an e-mail message, it will use the message was sent to the address.

    I hope this helps.
    Thank you
    Gloria
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Unable to create the stored procedure batch Oracle Script from Windows

    Hello
    I put my code here please let me know where I have error
    Cmd
    -------
    DNAME SET = %3
    SET UerName = %1
    SET Pssword = %2
    SET Opdir = C:\Users\testuser\
    sqlplus-s '% UerName%/%Pssword%@%DNAME%' @%Opdir%procdure.sql

    procedure. SQL
    --------------
    WHENEVER SQLERROR EXIT SQL. SQLCODE ROLLBACK
    WHENEVER OSERROR EXIT SQL. OSCODE RESTORATION
    SET SERVEROUTPUT ON
    SET ECHO ON
    AUTOPRINT SET ON
    RUN THE DBMS_OUTPUT. ENABLE (1000000)
    COIL Seq.log
    SET linesize 1000
    CREATE PROCEDURE test "()" ""
    AS
    BEGIN
    NULL;
    END test;
    SPOOL OFF
    OUTPUT
    -----------

    Demostrating how I executed


    C:\Users\nikhilgk > otherobj AAA AAA TEST
    C:\Users\nikhilgk > SET DNAME = TEST
    C:\Users\nikhilgk > SET UerName = AAA

    C:\Users\nikhilgk > SET Pssword = AAA

    C:\Users\nikhilgk > SET LOG = C:\Users

    C:\Users\nikhilgk > SET Opdir = C:\Users\testuser\

    C:\Users\nikhilgk > sqlplus s 'AAA/AAA@TEST' @procdure.sql

    PL/SQL procedure successfully completed.

    ------------------------
    Journal is is created with size 0 KB.

    I connected to SQLPLUS and questioned
    SQL > select object_name from user_objects where type_objet = 'PROCEDURE '.

    no selected line.

    you have'nt actually run the code to create procedure.

    create PROCEDURE TEST()
    AS
    BEGIN
    NULL;
    END test;
    /  -- you need this 
    

    also if you want to access without double quotes all the time, do not put double quotes on the name

    And I think you should go out; rather than leave. That's why you have a size zero.

    Published by: Keith Jamieson 31 August 2012 13:21

  • Creating a table using a stored procedure, error

    MY querry is as follows:

    create or replace
    PROCEDURE New_Account_Activations)
    MYDATE_DD OUT VARCHAR2,
    MYDATE_MM OUT VARCHAR2,
    MYDATE_YYYY OUT VARCHAR2,
    MYDATE OUT VARCHAR2,
    VAR1 OUT VARCHAR2,
    VAR2 OUT VARCHAR2,
    VAR3 OUT VARCHAR2,
    TABLE_NAME OUT VARCHAR2) IS

    BEGIN
    SELECT TO_CHAR (SYSDATE-2, 'YYYY') INTO MYDATE_YYYY FROM DUAL;
    SELECT TO_CHAR (SYSDATE-2, "MM") INTO MYDATE_MM FROM DUAL;
    SELECT TO_CHAR (SYSDATE-2, 'DD') INTO MYDATE_DD FROM DUAL;
    MYDATE: = MYDATE_YYYY | MYDATE_MM | MYDATE_DD | '000000.000Z';
    -TABLE_NAME: = "NEWACCOUNTACTI_TEST";
    VAR1: = 'B ';.
    VAR2: = 'A ';
    VAR3: = 'Y ';
    Table_name: = "NewAccountActi" | '_' || MYDATE_YYYY | '_'|| MYDATE_MM | '_'|| MYDATE_DD;
    run immediately "CREATE TABLE tbl_name AS SELECT * FROM NEWACCOUNTACTI_TEST WHERE 1 = 0';"

    END;

    ERRORS

    ORA-01031: insufficient privileges

    ORA-06512: at "JACK. NEW_ACCOUNT_ACTIVATIONS', line 21

    ORA-06512: at the level of line 12

    Process is complete.

    WRONG FORUM!

    This forum is for Sql Developer issues only. Please mark the thread ANSWERED and repost it in SQL and PL/SQL forum.

    https://forums.Oracle.com/community/Developer/English/oracle_database/sql_and_pl_sql

    As says the Exception, your user JACK does NOT CREATE TABLE privileges granted DIRECTLY to them (not through a role) on the NEWACCOUNTACTI_TEST table. Grant privileges directly to the user.

    If that does not meet your question repost your question in the forum; do NOT here.

  • Why create the MP3 version and get album artwork was deleted?

    Hello

    Is anyone know why the possibility of creating another version of the version of i.e.'create MP3 of the song "has been deleted to new iTunes and Get Album artwork?

    These two features are still there, but they have been moved. Create < Format > Version is now under file > convert and Get Album artwork works if you right click on the work, or a work space in the albums or songs views.

    TT2

  • passage of table to procedure pl/sql-pls-00306 wrong number/types of args

    its oracle 10.2 database;

    I have a simple procedure with parameters of table based on the sql types.
    for example

    create or replace type vt_attrname is table of the varchar2 (50);

    My call to the procedure now works when the table is empty;
    whenever I bulk collect in my local table, I get a compilation error.

    for example
    declare
    my_array  vt_attrname;
    begin
    select label
      bulk collect
      into my_array
      from table_name
    where 1=1;
    
    my_proc(p_array=>my_array);  -- syntax error
    end;
    If I pass null, the call works but obviously the array is empty.

    I read something about being incompatible between sqltypes and pl/sql varray.

    How to work around this problem?

    Most collect works very well.
    A small example would be appreciated.

    Take a look at your code:

    v_cardapplattrtag   vt_attrname;
    

    and the protototype of procedure:

    ppt_cardapplattrtag     IN     VT_BPATTRNAME DEFAULT NULL
    

    Amiel

  • Create the table with the environment variables

    Hi all
    When an event occurs, I would create a table by a planning procedure.
    I can create a table with these last or similar syntax:

    create table % s_ %t in select acme_ * from a;

    I would use this syntax because this event could be spend more time per day and so I can check.
    is this possible?

    Thank you very much
    Ciao
    Alberto

    Albertofro wrote:
    Hi all
    When an event occurs, I would create a table by a planning procedure.
    I can create a table with these last or similar syntax:

    create table % s_ %t in select acme_ * from a;

    I would use this syntax because this event could be spend more time per day and so I can check.
    is this possible?

    Thank you very much
    Ciao
    Alberto

    To dynamically create a table, you must use EXECUTE IMMEDIATE. If you want your table to be padded with timestamp name you can do it with the function TO_CHAR and SYSDATE.

    An example

    execute immediate 'create table acme_' || to_char(sysdate, 'DDMMYYYYHH24MISS') || ' as select * from a';
    

Maybe you are looking for