How to use a package?

Hello

I have a package PL/SQL, called UTIL_TABLE, which is owned by the user DNOQ (this user that can contain objects of applications),

In the UTIL_TABLE package, it includes a procedure, called split_partition, its content is as below,

/***********************************************
* Procedure to split a partition of a table *.
************************************************/

PROCEDURE split_partition (tablename VARCHAR2,

part_name VARCHAR2,
split_point VARCHAR2,
first_part VARCHAR2,
second_part VARCHAR2,
options of VARCHAR2: = NULL)
IS

BEGIN

priv_rec: = get_privileges (tablename);

-IF priv_rec.split_part = 'Y' THEN
IF priv_rec.alter_table = "Y" THEN

sql_str: = 'ALTER TABLE ' | TableName.
"SPLIT PARTITION" | part_name | ' To (' | split_point |) ') ' ||
' IN (PARTITION ' | first_part |) ',' ||
'PARTITION | second_part | ') ' ||
options;

Util_Table.dynamicSQL (sql_str, err_txt, err_no);

IF (err_no = 0) THEN
user_messages (no_error, 'Split Partition');
ON THE OTHER
user_messages (other_error, ' error split Partition, s/n call: ' | err_txt);
END IF;


ON THE OTHER
user_messages (auth_error, 'User' |) THE USER |
'is not allowed to split a Partition in this table, call s/n');
END IF;

END;

If the database as s/n connection, I can do a split a partition of table ACCOUNT (belonged to the DNOQ user), as:

SQL > ALTER TABLE DONQ. ACCOUNT SPLIT PARTITION ACCOUNT_DEFAULT at (TIMESTAMP'2015-02-08 00:00:00 ') INTO (partition ACCOUNT_P2015WK06, PARTITION ACCOUNT_DEFAULT);

Modified table.

-table called partitioning ULTIMATELY owned by DONQ.

SQL > desc DONQ. ACCOUNT

Name                                      Null?    Type

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

ID NOT NULL NUMBER

ACCOUNT_NUMBER VARCHAR2 (255)

PHONE_NUMBER VARCHAR2 (255)

SELECTION_TIME TIMESTAMP (6) = > vary us the partition using this column!

FILE_ID VARCHAR2 (255)

CSL_NAME VARCHAR2 (255)

QUEUE_NAME VARCHAR2 (255)

RESULT_CODE_CLASS VARCHAR2 (255)

RESULT_CODE VARCHAR2 (255)

RESULT_CODE_ACTION VARCHAR2 (255)

ACCOUNT_STATUS VARCHAR2 (255)

AGENT_ID_RESULT_TIME TIMESTAMP (6)

AGENT_ID VARCHAR2 (64)

NUMBER OF CALL_DURATION

TENANT_ID NOT NULL NUMBER

I'm a user of the application, called DONQ_APP, it has all the DML privileges against table ACCOUNT, then log in as DONQ_APP, we try to use the procedure split_partition to divide a new partition.

SQL > alter session set current_schema = DONQ_APP;

Modified session.

SQL > exec UTIL_TABLE.split_partition ('ACCOUNT', 'ACCOUNT_DEFAULT', ' (TIMESTAMP'2015-02-15 00:00:00 'TIMESTAMP' 2015-02-15 00:00:00 ') "', 'ACCOUNT_P2015WK07', ' ACCOUNT_DEFAULTe ', 'ACCOUNT_P2015WK07', 'ACCOUNT_DEFAULT');

SP2-0552: Bind variable '00' not declared.

the UTIL_TABLE package is valid.

How can I do to use this procedure correctly?

I thank very you much in advance!


You deleted your last response and my response, so I'll post it again.

You said in your last answer that you receive an error message on the user SYS is not in your privilege table.

As I told you before that the message that you receive are generated by YOUR function you call this line:

Util_Table.dynamicSQL (sql_str, err_txt, err_no);

This feature (your code) accesses YOUR privilege table. Your last answer deleted posted INSERT statements for this privilege table. This table has the privilege and the USER that the user has. The inserts did NOT all the lines for the SYS user if YOUR code has caused an exception because you can't find all the lines in your table for the user SYS.

Unfortunately, you did not check for this exception so it caused your code shown above to fail.

You must follow best practices when you develop a code, but especially for dynamic code.

1. ALWAYS print the query you build dynamically

2. ALWAYS run/test/tune this query manually until it runs and correctly

3. ALWAYS intercept all exceptions that might occur and deal with them appropriately.

If you do the above, you will see what is the problem with your query string dynamically built.

Tags: Database

Similar Questions

  • How to use a package as an interface to do DML on a region in a table?

    Hello

    I want to build a page to perform DML. However, I would use a package that contains the procedures to select, insert, update, and delete. The reason is that there is a one-to-many relationship between the table display and tables in the database.

    When the page appears first of all, I wish to draw the SELECTION procedure.
    When the user is done with their changes, I want to loop through the rows and perform
    the DELETION procedure on all deleted rows and
    UPDATE on each changed row procedure.

    What is the best way to do it?
    Where should I start / learning of reading?

    Thank you

    Gabor

    Hello

    This link might help you
    http://Apex-SMB.blogspot.com/2008/07/manually-creating-tabular-form.html

    BR, Jari

  • How to know the tables used in packages of a schema.

    How to know the tables used in packages of a pattern that I have connected.

    SELECT DISTINCT referenced_owner, referenced_name

    Of all_dependencies

    Owner WHERE = "MY_USER_NAME".

    AND type ('PACKAGE', 'BODY of PACKAGE')

    AND referenced_type = 'TABLE '.

  • If I subscribe to the applications Adobe CC everyone (students and teachers), how many computers can I use the package on?

    If I subscribe to the applications Adobe CC all (students and teachers).

    How many computers can I use the package?

    Please check the FAQ - Licensing FAQ: can I install Creative Cloud on several computers?

    Thank you

    Bev

  • How to use a function inside the package?

    Hello

    You will need to convert weight unit of kilogram kips when filling out the weight values into a temporary table. In our database, schema there is a function called convert_units is available.
    How could I use this feature in my package? My package is also resides in the same database schema.

    Here, I pasted the function.
         convert_units
       (
         in_base_unit_id       NUMBER,
         in_conversion_unit_id NUMBER,
         in_value              NUMBER
       ) RETURN NUMBER AS
    CURSOR unit_cur IS
      SELECT *
      FROM units_conversion
      WHERE base_unit_id = in_base_unit_id
        AND conversion_unit_id = in_conversion_unit_id;
    unit_rec unit_cur%ROWTYPE;
    BEGIN
      OPEN unit_cur;
      FETCH unit_cur INTO unit_rec;
      IF unit_cur%NOTFOUND THEN
        unit_rec := NULL;
      END IF;
      CLOSE unit_cur;
      RETURN (in_value+unit_rec.pre_adjust_add)*(unit_rec.rate);
    END convert_units;

    Hello

    It seems that the first two arguments of this function are ID in the units_conversion table. If you know this id = 1234 means kilograms, 9876 means kips, then you can do things like:

    wt_kips := convert_units (1234, 9876, wt_kilograms);
    

    or

    INSERT INTO tmp_table ( ..., weight_val,                               ...)
           VALUES           ( ..., convert_units (1234, 9876, wt_kilograms), ...);
    

    I can't just look at the code which could be any valid ID. I'm not even sure of the order of the arguments. I hope you have instructions on how to use the function.

    If the function is in a package named pk_xyz (a different package to the one in which you call it), add the name of the package, like this

    wt_kips := pk_xyz.convert_units (1234, 9876, wt_kilograms);
    
  • After replacing the motherboard of PC how can use the license package, is the same hard drive.

    Mr President, our pc is repaired & change the motherboard and now how to use the product under license of photoshop

    It could be cleaner if you uninstall the products in question, using the CS cleanup tool and then contact Adobe technical support via chat and ask to reset your activations before install and activate the software again.

    Adobe Creative Suite cleanup tool

    helps resolve installation for CS3 thru CS6 and creative cloud problems

    http://www.Adobe.com/support/contact/cscleanertool.html

    To the link below, click on the still need help? the option in the blue box below and choose the option to chat...

    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If it fails to connect, try to use another browser.

    Serial number and activation support (non - CC) chat

    https://helpx.Adobe.com/contact.html?step=PHSP-PHXS_downloading-installing-setting-up_lice nsing-activation_stillNeedHelp

    Before you uninstall, you can see if you can extract the serial number in case you don't have it at hand.

    If it's a Windows machine, and then try running Belarc Advisor

    http://www.Belarc.com/free_download.html

    For a Mac, you can try:

    https://Mac-product-key-Finder.com/

  • How to use the recovery on Satellite A215-S7422 DVDs

    Hello

    I have A215-S7422
    First of all, I like the Vista Home Premium, until I had a few problems with my operating system.

    I'm downgrading my laptop for Windows XP SP2 home edition.
    I formatted all the HARD drive, to make a few partitions.
    A few weeks later I tried to Vista using the DVD recovery system which is included in the package when I bought the camera.
    Unfortunately, the DVD without being detected in the first over.

    Do you have any idea how to use this recovery DVD?
    It is any special program to activate the recovery DVDs?

    Please, help me.

    May I ask why create you double assignments?
    You already asked this here:
    http://forums.computers.Toshiba-Europe.com/forums/message.jspa?MessageID=140003

    Secondly, as already described in different threads, you have to boot from the recovery DVD and this will begin the new installation image.

  • How to use USB CAN 8473, code for the basic example

    Hi all.

    I use NEITHER USB-8473 CAN transmit and receive data via CAN.

    I have traveled a lot a lot of pages related to this and realized that the API will not work for USB - CAN. Can someone tell me please how to use this USB-8473.

    Maybe an exaple program would help me. (It is not PCI it we USB,)

    Thank you.

    You will need to install NI-CAN, if you don't have already done.  This is the API that you can use with a 8473.  After installing, open Explorer Measurement & Automation and make sure that you can see the 8473 under your devices.

    Here is a sample VI (LabVIEW 2009) that I wrote for another developer to make the CAN communication basic tests.  You enter a package CAN as a series of hexadecimal bytes separated by spaces, and it will send it to you.  It displays every CAN packet it receives in the same format.

  • How to use outside of class in the packed library plugins

    I found the article very useful to Michael Lacasse (https://decibel.ni.com/content/docs/DOC-19176) how to use the library packaged as plugins. This approach makes the most sense when you try to distribute additional code after that your executable is already installed.

    My problem is that when I try to use a class from the main code in a plugin, plugins no longer works. Ideally, I would have liked the parent plugin interface to inherit from a class that is used in the main code, either by using the class as parameter of the plugin would be the next best thing.

    I had several mistakes, some runtime (#1448) or at the time of publishing ("VI it does not match other screws in the method: connector side terminal (s)"). I set to use clusters to transfer data to the plugins.

    My question is: is it possible to use a class defined in the main code in a packed-project-library, either inherited or as a parameter? If Yes, do you have any examples?

    It is not made with real CLASS structures, but I do the same with PPLs.

    Don't try to inherit from something in the MAIN host.

    Create the ancestor class in a separate PPL.

    Use it for the most PART, as it is.

    Inherit it in your modules.

  • Upgrade Vista to 7 using a package of upgrade used on a moment off PC service

    I had a PC that has been upgraded from Vista to 7.  I rebuilt this PC with a new motherboard and CPU and installed a newly purchased Windows 8.1.  Can I use the package of upgrade of Windows 7 should I update another Vista PC that my wife uses for Windows 7?  I have problems with the license or it being considered as authentic?

    Hello

    You don't say where you got the Windows 7 Upgrade from.

    If she was part of the free Windows 7 Upgrade from Vista, which ran for 6 months before Windows 7 release and just after, no, you can't use it on another machine.

    If you have purchased the commercial windows 7 upgrade yourself, Yes, you can use it on another machine as long as it is not installed elsewhere.

    It may require an Activation of the phone, and you must not follow the guests of the car, but hold a real Denis to explain to.

    "How to activate Vista normally and by Activation of the phone '

    http://www.Vistax64.com/tutorials/84488-activate-Vista-phone.html

    See you soon.

  • How to use the scan on a 4215i function all in one printer

    How to use the function scan with this printer with windows 8. I did the installation but the scan function is not wwork

    You have the printer Officejet 4215 all-in-one?

    If so, then there is no complete features in the printer driver.  The printer is using the Windows printer drivers Update menu.  For more information on using the driver from Windows Update, click here.

    You have this printer connected via USB?  If so, then there is workaround methods to get the printer to scan, as the old software package is not available on Windows 8.  In the above linked document, scroll down to the section on how to scan with updated driver for information about how to perform these types of scans.  I hope this helps.

  • How the names of Package exposed?

    I'm curious to know how the names of package in a native BlackBerry Java application are exposed to other applications or the operating system.  I know, for example, classes persistables but be only defined, otherwise you will get ' MyApplication startup error: class 'com.example.myapplication.MyClass' multiply defined. "  What other ways the package names are visible?

    As indicated in my thread on location on 4.6.1 performance problems, there are some strange interactions between the size of the application, the package names and the EventInjector.  Without an official fix or circumvention of the RIM, our only option may be to rename our packages.  I would like to understand the implications of this good because down us this road.

    Thank you

    RIM said the package names are exposed through the research of Class.forName and Persistable classes.  Some people use the name of the package in the COD file names, but I don't do that.  Assuming that I chose something unique, it will probably not see my name of the package to all the.

    Thanks simon.

  • How to use the global variable in the table target?

    Hello

    I am trying to load several files into a single interface. the data is loaded successfully. 92. the files are there. for this I used variables and package.

    My requrement is 92 files of data loaded into the target table. I want to know what data from file.

    to this I added a column (filename) to the existing target table.

    If I used joints (not same condition), its totally wrong. all file names are coming.

    Please see the following screenshots.

    err27.jpg

    exit; target table.

    err26.jpg

    in fact in the target table. first 10 lines are coming from file.i.e first _ACCOUNT_LIMIT_511.TXT. but all the files names are coming.

    I'm confuse. After the first data file inserted then insert second data file. in that all file names are coming. Please help me.

    I thought that the global variable is preferable to identify the data came from which file.

    to do this, the global variable is used in the target table. I don't always have my exit.

    Please help me.

    Thanks in advance.

    err25.jpg

    Hello

    You can use the same way, how you use the project variable, just you have to do a thin is #GLOBAL.variable_name for example: #GLOBAL. SMART_AL_FILE_NAME_S

    Note: Make sure you that while you use one variable overall in interface, indicator should be staged as you chose above the screen

    hope this helps you

    Kind regards

    Phanikanth

  • How to use the Adobe Air?  Adobe Flash must Adobe Air to work properly?

    How to use the Adobe Air?  Adobe Flash must Adobe Air to work properly?

    Flash Player requires no AIR.

    AIR is a technology that allows Flash developers to make stand-alone desktop applications and mobile.  Some desktop applications of AIR (generally older) require the shared AIR runtime to exploit, while others are packaged in stand-alone applications with no external dependencies.

    Hope that helps.

  • Hey, who knows how to remove a package that I bought?

    Hey, who knows how to remove a package that I bought?

    Cancel your membership Adobe Creative Cloud

    To the link below, click on the still need help? option in the blue box below and choose the option to chat or by phone...
    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If he continues to not try to use a different browser.

    https://helpx.Adobe.com/contact.html?step=CCSN_membership-account-payment_cancel-your-memb ership_stillNeedHelp

Maybe you are looking for