When using DBMS_SQL

Hello

Q: in which of the following will you use the DBMS_SQL package that is the method of treatment of the dynamic SQL statements only?

Each correct answer represents a complete solution. Choose all that apply.

(CORRECT ANSWER :) was when a column in a where clause clause name is unidentified at compile time)

(:) CORRECT ANSWER B when the number of columns in a query is not identified before execution

(WRONG ANSWER :) C when a query returns a single line

(WRONG ANSWER :) D when a column name in an orderby clause is not identified during execution

I think that you don't need DBMS_SQL for option A; You can use NDS for that:

create or replace procedure p28L (c1 varchar2, number of v1) as

s varchar2 (100);

EmpNo number;

number of SAL;

Start

s: =' select empno, sal from emp where ' | C1 | '=' || v1;

run immediately s empno, sal;

dbms_output.put_line ('empno: ' | empno |) ', sal: ' | SAL);

end;

/

display errors

exec ('empno', 7844) p28L;

/

Scott@ORCL > @C:\Users\J\Documents\SQL\test28.sql

Created procedure.

No errors.

EmpNo: 7844, sal: 1500

What is the correct answer: A and B or B just?

Thank you

J

Your immediate execution example does not bind variable. It is a mistake.

In regard to the multiple choice questions - has never really like those because they are too rigid.

There are 2 basic reasons for the use of DBMS_SQL:

  1. Variable bind variables.
  2. Unknown SQL projection

But these aren't the only reasons. For example. You must select sysdate from a remote database via a db link.

Following SQL will display the date and time of the BD local as the sysdate function is resolved locally:

Select sysdate from dual@db_link

No matter how you try to build this SQL cursor locally - if local use sysdate, the scope of the cursor is local and the SQL function is local.

So, how do you get the function sysdate to be send to the remote database and not be resolved locally?

Using DBMS_SQL slider interface of the remote database to alter the scope of the cursor from local to remote.

So there are a number of reasons for wanting to use DBMS_SQL - beyond a ridiculous answer multiple choice list. IMO.

Tags: Database

Similar Questions

  • When the dbms_sql.bind_variable is used?

    DB version: 11.2

    I'm new kind of PL/SQL and I've never worked with DBMS_SQL. BIND_VARIABLE. Currently, I am going through some codes that we have that a lot of DBMS_SQL. BIND_VARIABLE.

    Googling, I got to know the basic of its operation mechanism.

    I have 2 questions.

    1. Why do people use dbms_sql.bind_variable?


    2. in our firm, it is being implemented to make many insertions as below.

    The code is displayed as below (Snipped to show only the relevant parts)

    No idea why the INSERT is in like that?

     
    begin
    --- At first a CURSOR is formed .
    
    cursor YCURS select column1, 
                  column2,
                  .
                  .
                  .
              from manh_parcel_hdr
              where ..
              ;
    
            
              
    typ_1 varchar2(35);
    typ_2 varchar2(35);
     
     --| Then a variable is created like below
     
     manh_parcel_hdr_item number;  
     
     manh_parcel_hdr_item := dbms_sql.open_cursor;
     
     -- Then this INSERT is constructed 
     
     dbms_sql.parse( manh_parcel_hdr_item, 'insert into manh_parcel_hdr_item ( sku_id, sku_type, .......) values (  :sku_id, :sku_type, );
    
    
    typ_1 := ' ';
    typ_2 := ' ';
    
    
    
    for rec IN YCURS 
    loop
        pltChanged_1 := 0;
        pltChanged_2 := 0;
         
         typ_1 := rec.ACCOUNTNO_2||rec.CURRENCYCODE_2;
         
         IF typ_1 != typ_2 THEN
         
             IF rec.ACCTTYPE_1 != rec.ACCTTYPE_2  ... some more conditions...
                 rec.ACCTTYPE_1 := rec.ACCTTYPE_2;
                 pltChanged_1 := 1;
                 
                 END IF; 
                 
                 dbms_sql.bind_variable( manh_parcel_hdr_item,':ACCTTYPE', rec.ACCTTYPE_2 ); --- What is happening here ?
                 
                 
             ELSE
                 dbms_sql.bind_variable( manh_parcel_hdr_item,':ACCTTYPE', '');  ---------> and here ?
             END IF;
         
    ...
    ..

    Greeny wrote:

    No idea why the INSERT is in like that?

    My guess is to re - use the cursor INSERT handle - which is something that the PL/SQL optimizer will be done automatically.

    A slider is like a program. Bind variable are as input data for this program. It works essentially as follows. You send the source SQL (with bind variable) to the SQL engine. For example

    insert into footab values( :1, :2 )
    

    This code is analyzed and a cursor is created. You return a SQL engine cursor handle. The integration program is ready to run.

    You can now assign values to variables +: 1 + and +: 2 + this program. This is what we call liaison.

    Once you have assigned to them, you can now run this program - and it inserts these values into the table.

    Without releasing the program (closing the cursor), you can assign new values (bind) and run the program again to insert another line. And repeat this operation until you have all the data processed and inserted the required lines.

    Last step is of course the release program.

    And it is essentially in a few words what a slider is and how a cursor is used.

    My guess is that your developer (s) did not want to encode an implicit cursor Insert in a loop - possibly think that each iteration of the loop will need to PL/SQL to create a cursor insert program, linking values to it, run it and close it. Then repeat the loop.

    Thus, the developer manaually created the cursor using DBMS_SQL before the loop. And inside the loop, bind variables and run the slider. Providing this code reuses the same cursor insert again and again.

    It is almost * correct approach in customer languages like C/C++, Java, PHP, Perl and so on.

    However, it is not necessary in PL/SQL, as well as the optimizer recognizes what is done and how to make it optimally - create a cursor to the Insert SQL in this loop and re - use the handle to the cursor for each iteration of the loop.

    The only real reason to use cursor DBMS_SQL in PL/SQL interface, is to treat dynamic SQL, a dynamic binding statements and dynamic recovery.

    * The comment almost. The code is not really ideal. This bind-data and run cursor per loop iteration, it requires a 100 dregs and a cursor of 100 runs to insert a 100 lines. Sliders have a binding interface in bulk. This means that the code can bind a table - in other words, assign an array of 100 values of variable +: 1 + and a picture of a 100 variable values +: 2 +. The code then performs the cursor. Times. And cursor processes these bind tables and inserts a 100 lines.

    For customers Java/Perl/etc., which reduced the number of round trips to the database. In PL/SQL, this is done using the FORALL statement and reduced the number of switches in context of the PL/SQL engine to the SQL engine.

  • screen saver turns on when using FaceTime

    Since the update to MAC OS Sierra, I noticed that my screensaver activates when using FaceTime - most annoying because I have to quickly move the mouse to put it all again.

    He didn't get it until I've updated from El capitan, so I guess it's something to do with MacOS Sierra.

    He's not doing it with Youtube but I'm still trying with Skype.

    Screen saver works as it should do it with an ordinary application (for example, safari, etc.) Pages) if I don't move the mouse or keyboard for the specified time (five minutes).

    I do not have hot set of corners, the display is set on turn off (energy prefs is system) after 10 minutes. Screen saver is five minutes of inactivity.

    I have an iMac 27 "retina, first generation (a little less than two years) with i5 and 16 gig memory, standard graphics M290X.

    I missed easy adjustment here?

    I have it, feel also my parents as well.

  • Why can I never get a good picture on my imac when using Skype?

    Why can I never get a good picture on my imac when using Skype?

    I use the free Skype to talk to my friend in China every week. They always see me on their computer or phone clearly, but I can never get a good video of them, clues why? I see a good image of myself, but never of them. I can't adjust the settings of the built-in camera because they are fixed. Is this my router modem, which is 8 years old now. What is causing this problem. If you look on YouTube there are hundreds and thousands of good quality webcam videos then why am I having this eternal problem year after year? I've got El Capitan OSX

    If they can see you clearly, the problem is not on your side - at least not in your Mac. Could be the router or you internet connection. Otherwise: https://support.skype.com/en/skype/mac/

  • When using on the part of the family can they others besides Organizer individual payments?

    When using on the part of the family can others besides the Organizer make individual payments without using the card of the organizers?

    Family sharing makes it easy for up to 6 people in your family share each other iBooks, iTunes and App Store purchases without sharing accounts.

    "Pay for purchases with the same credit card families and approve kids' expenses directly from the device of a parent." And share photos, a family calendar and more to help keep everyone connected. »

    Implement the family sharing - Apple Support

  • Where do I put the AutoFill feature when using Firefox?

    You people do a great job of describing 'How to use Auto Fill'... but nowhere in this article does say WHERE - to implement the feature when using Firefox.

    How and where can I find the setting?

    Thank you.

    PS: maybe that should be in the article somewhere.

    What about filling the data in a form (input field) on a web page?

    See:

  • Distortions of the screen when using Firefox on Android

    Hi, a recurring problem - when using Firefox on my Android Web site, are often distorted. If I try to zoom before to increase the size of police or image during playback, the screen breaks and distorts, with different sections of text and images disappear (black sections of the screen appear) or overlapping, often in a different font sizes. The Web site displayed on the screen as "jumps around." The same thing happens if I try to select text for copy - it is impossible to select all or selection is distorted. I have not had this problem before and noticed only recently. Almost impossible to use the browser now! What is the result of an automatic update of the software? Help, please! Thank you.

    Please try to update to Firefox 38.

  • Strange glitch Visual on the taskbar when using Firefox

    Hello

    I feel a strange glitch Visual on the taskbar when using firefox.

    Please take a look at this short video because it shows the problem, it's almost impossible to show in pictures.

    https://DL.dropboxusercontent.com/u/12595174/VIDEO0016.3gp

    I use firefox on Windows 7 Pro 64 bit v36.0.1. Video card is an ASUS R9 280 X using the latest drivers from AMD 14.12 Catalyst Omega Software.

    Motherboard is an ASUS M5A88 with 16 GB of ram and a processor of 6300 FX.

    It is a new construction that I have implemented in the last 24 hours, and this behavior was not present on the system using the same version of windows, firefox and even map chart and drivers. But on another card mother and CPU. Previous Board of Directors has been
    M4A79XTD EVO with a Phenom II X 4 955BE.

    The glitching does not occur when it is on the desktop and firefox is closed. It will not occur when you use IE - 64 nor does it when I am using the steam software or any Explorer windows/opening files.

    All the motherboard drivers are installed correctly, the integrated graphics card is disabled in the BIOS. I disabled the settings of firefox for hardware acceleration, smooth scrolling and text... to see if it was the question. It wasn't.

    I'd appreciate any help to solve this... Really, I don't want to use a different browser but it's bad enough and quite distracting to really annoy me, and I don't see any alternative.

    Thank you very much.
    H

    Hi jscher2000

    I was about to post a reply, because a friend suggested that maybe that's a rendering of issue rather than a firefox one video card even if it's strange how it affected firefox only. I didn't have a chance to test it on Chrome as it is a new construction and I don't want to install the software, I do not use.

    I went to the Manager of catalyst and had a glance to the settings. I changed something, but no help... I then started to make a simple change and test until I found that the activation "gpu up-scaling" in the properties of digital flat screens has solved the problem.

    I am now free twinkle

    Thanks for your quick response however.

  • Outlook has started to get a connection not approved when using firefox

    Outlook started having no reliable connection error when using firefox. Not sure why it started, but all the few minutes that it times out and I have to re - open outlook from google. He does not receive this error on IE or firefox android. I use win 7. I talked with microsoft and they say it's a problem of firefox not outlook.

    I tried the things:
    -Updated firefox
    -Updated antivirus
    -antivirus scans
    -disable the anti-virus
    -from firefox in safe mode.
    -clear all the cache and history
    -Disable all add-ons
    -system restore
    -past by mistake "untrusted connection" on the help of mozilla (does not solve it. There is no option to allow the certificate)
    -search on the net for a similar problem (found nothing)

    So far, it has been like this for a week and its starting to piss me off as it happened out of the blue.

    I solved the problem for someone else who has the same problem.

    Options - troubleshooting information - reset firefox

  • When using YouTube, I get foreign on-screen words. This does not happen with Safari.

    When using YouTube, I get foreign on-screen words. This does not happen with Safari.

    Clear the cache and cookies only from Web sites that are causing problems.

    "Clear the Cache":

    • Firefox > Preferences > advanced > network > content caching Web: 'clear now '.

    'Delete Cookies' sites causing problems:

    • Firefox > Preferences > privacy > Cookies: "show the Cookies".

    You can write a check for corrupted fonts and duplicate and other police issues:

  • How to reduce the volume of alerts in FF when using webmail without lowering the system volume (Mac)?

    I use Mac OS 10.6.8.
    When I access my webmail via Firefox, I get a Twitter hard whenever I have send or receive a new email.
    I contacted my ISP (Optimum) and they said tell Firefox to my computer to make the sound. They say that they have no control over it.
    I tried to reduce the volume of alerts in my system prefs, but it has not affected the volume of FF.

    How reduce or disable volume in FF when using webmail without lowering system volume?

    Thank you!!! The 'sound' button off in their preferences. Fixed. (It was so freakin ' fort!)

    I, in turn, chatted with Service to customer of Optimum and tells them that they must tell their supervisor to better educate their own service to the customer, instead of passing the ball. We'll see.

    Let contributors Mozilla smart to not return the ball.

  • Lag when using track changes in the large document

    I do experience lag when using "track changes" in a large .pages document (about 180 pages). I get the wheel of the Rainbow for about 10 seconds after completing each change, which makes it very difficult to obtain concrete results. Other applications on my computer work simultaneously without a hiccup. I use the latest version of the pages on the latest Mac OS. Anyone with a similar problem? Tips to solve this problem?

    It's unfortunate that Apple has not adopted an icon "Achtung Minen!" for the v5 Pages. It is slower than the second coming on intermediate to large documents, and it only gets worse when you add images at higher resolution. Apple has not designed there is a professional-quality, or as a realistic replacement processor for MS Word.

    There is nothing you can do, but seriously, re - evaluate your software solution for processing.

    Here's an icon from the WAD of v5.6.2 request Pages. Prophetic isn't?

  • Google results is not accurate when using Firefox

    After that I installed Chrome, when I used the search on Google with Firefox, the results have been distorted. For example, when I searched for Netflix using google on Firefox, the home page does not appear. When I used google on Chrome or IE, Netflix home page would then appear as always. The results were the same, using any keyword, like Yahoo, Ebay, etc. Is there a reason for the change of the algorithm when using google and Firefox?

    You seem to be signed in to Google, so it is possible that Google stores your search history and offers you "customized" links.

    Is there a difference in when you're not connected?

    So, you can check the parameters of Google to see if web history is enabled (click on the gear icon in the form on the page of Google results).

  • I have a problem when using Google Maps, at a certain point my custards computer window and says there is a problem with the display drivers and he recovered, but it is not. Problem does not occur with Int Explorrer, so I don't think it's the computer

    When using google maps via Firefox, after asking a place which is not the General section of North America who comes up regularly, the firefox screen becomes white with a narrow banner at the top. A message appears in the lower right corner that says something on display drivers having had a problem, but now have been recovered. However, the display is not recover and the message of the banner is that Firefox is not responding. When I go to restart Firefox if I'm about to restore, the page is still frozen.
    I don't think there is a problem with my computer because it doesn't happen if I used to go to google maps, then G-cards works normally.
    This phenomenon didn't happen before the last update Google or Firefox. I used Fiefox for some years and also Google Maps on previous computers and on this one and not had it before.
    It is a relatively young computer (Asus EeSlate 121) less than a year. I have used Firefox since I bought it and until recently had no problem with Google Maps.

    I solved it myself, after the 'note' that was FF/Mozilla, just as I finished my message, commenting on what it was that my system was, I wnnt back to check my plug-ins, etc. I downloaded the latest Java, the TWO 32-bit AND 64-bit versions and latest Firefox.
    Now everything works.
    Thank you
    B.

  • I a s 6 more and when using the phone, if my face touches the screen it clicks on the logout button and the phone hangs up the call. Is it possible to prevent this without holding the phone away from my face when calling?

    I a s 6 more and when using the phone, if my face touches the screen it clicks on the logout button and the phone hangs up the call. Is it possible to prevent this without holding the phone away from my face when calling?

    iPhones have a proximity sensor which is supposed to automatically turn off the screen when you hold it in your face. If this is not the case you can take the phone and have it checked.

Maybe you are looking for