Variable uses and placement

I'm new to PL/SQL and am trying to learn about variable valid uses/placement (any pointers to any docs is appreciated...)
All of the docs I've looked only mention declaration and assignment not valid placement.
When I use an input parameter to a cursor placement matters . I just don't understand why...
example... using the value "SCOTT" as an input parm to the c10 cursor replaces the "str_in" variable correctly and works...
1 declare
2 cursor c10(str_in IN varchar2) is
3 select username
4 from dba_users where username=str_in ;
5 begin
6 for r_c10 in c10('SCOTT') loop
7 dbms_output.put_line(r_c10.username);
8 end loop;
9* end;
SQL> /
SCOTT
PL/SQL procedure successfully completed.
However, when trying to replace another "word" it won't resolve the reference...
example... attempting to replace the from table_name as an input parm, no go...
1 declare
2 cursor c10(str_in IN varchar2) is
3 select username
4 from str_in where username='SCOTT' ;
5 begin
6 for r_c10 in c10('DBA_USERS') loop
7 dbms_output.put_line(r_c10.username);
8 end loop;
9* end;
SQL> /
from str_in where username='SCOTT' ;
ERROR at line 4:
ORA-06550: line 4, column 6:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 3, column 1:
PL/SQL: SQL Statement ignored
ORA-06550: line 7, column 26:
PLS-00364: loop index variable 'R_C10' use is invalid
ORA-06550: line 7, column 5:
PL/SQL: Statement ignored
Why can't it resolve the string ?
Any help is appreciated
dumb newbie...

Hi Jeff,
Welcome to the forum !
The query that is executed is always the same irrespective of the input parameter as this is STATIC sql.
Only the variables can be input parameters.
If you want the table name to change based on the input, you need to use dynamic sql.
Can you explain what you are trying to do with this program?
Thanks,
Rajesh.
--you can include the code in before and after the statement to preserve spaces.
Edited by: Rajesh Chamarthi on Oct 22, 2009 11:02 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • How do I have itunes use/detect my external hard drive and place music on the external drive from the itunes store? There are no music files on my pc yet.  I will like to do this after installing itunes 11 on my pc for the first time. I am using windows 7

    How do I have itunes use/detect my external hard drive and place music on the external drive from the itunes store? There are no music files on my pc yet.  I will like to do this after installing itunes 11 on my pc for the first time. I am using windows 7.  HP computer intel Dual Core.  Thanks for any help!

    Hey idw3,
    Welcome to Apple Support Communities, and thanks for the question. Follow the instructions on this article to move your iTunes Media folder to an external hard drive:
    iTunes for Windows: Moving your iTunes Media folder
    http://support.apple.com/kb/HT1364
    Regards,
    David

  • How do I eliminate the use and creation of big files in the profile - places.sqlite, urlclassifier3.sqlite, places.sqlite-wal?

    I want to eliminate the use and creation of big files in the profile - places.sqlite (10MB), urlclassifier3.sqlite (5MB), places.sqlite-wal (1MB)?
    Ffor urlclassifier, I tried disabling safebrowsing options (in security menu or in about:config), but file remains. Also if deleted it is still re-created with 5 MB.

    Start at http://www.mozilla.com and download the latest
    version. '''At the completion of the download don't let the setup start Firefox for you, when the setup ends, start Firefox in your normal manner this way you will be less likely to create a new profile.'''
    The extra startup pages are temporary -- read them. The next time
    Firefox comes up you should be back to starting with your normal home page.
    '''Note: Firefox must be down once the install starts. '''
    Close Firefox with File>Exit. Then make sure Firefox is not running --
    On Windows: check the "Processes" tab in the Windows Task Manager.
    '''On Mac: Firefox > Quit then Command+option+Esc, if Firefox running use Force quit'''
    Permission errors on Mac:
    '''If you were getting permission errors on a Mac, download the latest
    Firefox version, then uninstall and reinstall Firefox. Do not remove
    your profile directories and files as they contain your settings,
    bookmarks, history, extensions, passwords, and cookies.'''
    in any case once you are on 4.0 you might want to take a look at "(fx4)"
    * Fx4: Firefox 4.0 Problems and Orientation (#fx4) <br>http://dmcritchie.mvps.org/firefox/firefox-problems#fx4

  • Update and Write Back DataTable in Object Variable Using Script Component

    Hi All..
    I'm trying to update an Object Type Variable [ReadWrite] with a Data Flow Task Script Component. Variable is already holding a record set with Column(s) like, ID, Name, IsProcessed.
    Now in my Data Flow Script Component, I'm trying to 1st) Fill a DataTable with my variables value then 2nd) Loop through each Input Rows in Data Flow Component and accordingly if there is a match of ID then updating IsProcessed Column in DataTable. 3rd &Finally,
    Copy datatable back to Object Type Variable.
    Below is the code used and just for your ref. I tried Printing content of whole DataTable after Update. This looks perfect but not sure why my variable is able to capture it.
    using System;
    using System.Data;
    using System.Data.OleDb;
    using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
    using Microsoft.SqlServer.Dts.Runtime.Wrapper;
    using System.Windows.Forms;
    using System.Collections.Generic;
    using System.Text;
    [Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute]
    public class ScriptMain : UserComponent
    DataTable dt = new DataTable();
    OleDbDataAdapter adapter = new OleDbDataAdapter();
    List<string> listriuid = new List<string>();
    public override void PreExecute()
    base.PreExecute();
    public override void PostExecute()
    base.PostExecute();
    adapter.Fill(dt, this.Variables.varobjChildPackageLog);
    dt.AcceptChanges();
    foreach (DataRow row in dt.Rows)
    if (listriuid.Contains(row["ID"].ToString()))
    row["IsProcessed"] = "Y";
    // Just to see the Final Data Table Output
    //StringBuilder b = new StringBuilder();
    //foreach (System.Data.DataRow r in dt.Rows)
    // foreach (DataColumn c in dt.Columns)
    // b.Append(c.ColumnName.ToString() + ":" + r[c.ColumnName].ToString());
    //MessageBox.Show(b.ToString());
    this.Variables.varobjChildPackageLog = dt;
    dt.Dispose();
    adapter.Dispose();
    public override void RIUIDInput_ProcessInputRow(RIUIDInputBuffer Row)
    try
    listriuid.Add(Row.ID.ToString());
    catch (Exception ex)
    MessageBox.Show(ex.Message.ToString());
    Regards, Avik M.

    why do you need to do this in script task.
    This is just a matter of using lookup task while you retrive data from source itself to find the matches and use a derived column transform to check and set appropriate value for IsProcessed column. The object variable itself is not required and you dont
    even require a looping statement either!
    If both source and lookup tables are in same server then you can just wrap them inside source sql query itself to do matching and retrieve the value for IsProcessed within select statement itself in OLEDB Source inside data flow.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How can i find name of the variable used in the program and assign to a str

    double width= .333;
            int i;
            for (i = 0; i <=2; i ++){
                segment[i] = i+1;
            }is a bit of code...Is there anyway using which I can find out the variable names and assign them to string variables so that i can match them with another table ....
    That is I want the "width", "segment[0]", "segment[1]" and "segment[2]"...
    pls help...

    I am trying to find out the variable names in the program so that they can be matched against a given table for availability. I want to do that so that i can send the name, its type and value as a data packet to another node...I am not familiar with this...pls..would you give me a sample code

  • What is the usage of Request Variable ? and how we can use it ?

    Hi All,
    What is the usage of Request Variable ? and how we can use it ?
    Thanks in advance

    Hi,
    A Request variable is the same as a Session variable:
    http://download.oracle.com/docs/cd/E12096_01/books/admintool/admintool_Variables4.html
    Cheers,
    Daan Bakboord
    Scamander Solutions

  • How do you swap two variables A and B without using a 3rd variable?  No fun

    How do you swap two variables A and B without using a 3rd variable? No function or method allowed.
    For example:
    Given:
    A = 35
    B = 10
    Result
    A = 10
    B = 35

    How do you swap two variables A and B without using a
    3rd variable? No function or method allowed.
    For example:
    Given:
    A = 35
    B = 10
    Result
    A = 10
    B = 35
    A = A + B  (A = 35 + 10 = 45)
    B = A - B (B = 45 - 10 = 35)
    A = A - B (A = 45 - 35 = 10)

  • How do you swap two variables A and B without using a 3rd variable?

    How do you swap two variables A and B without using a 3rd variable? No function or method allowed.
    For example:
    Given:
    A = 35
    B = 10
    Result
    A = 10
    B = 35

    How do you swap two variables A and B without using a
    3rd variable? No function or method allowed.
    For example:
    Given:
    A = 35
    B = 10
    Result
    A = 10
    B = 35
    A = A + B  (A = 10 + 35 = 45)
    B = A - B (B = 45 - 35 = 10)
    A = A - B (A = 45 - 10 = 35)

  • Using Descriptions and Places

    I want to use the Places and Descriptions that I have in the Photo Info in slideshows and scrap books.  How do I do that?
    Also, I manually organize the photos and when I restart they are all out of manual order.  I am confused.  The Manual Sort By is still checked.

    Places information is automatically used in the thrvel theme slide show
    - descriptions depend on teh theme selected
    Where are you "organizaing" your photos? In events? Albums? the slide show? Remember we can not see you or your computer and know nothing that you do not tell us so give adaquate information that someone might be able to assist you
    LN

  • Remove AM/PM in time and place a leading zero using T-sql

    Hi All,
    I have a table with time column, lets say my source data looks like this..
    Time
    8:00AM
    10:00AM
    1:00PM
    12:30PM
    9:00AM
    My output should look below..basically I need  a t-sql to remove AM /PM and place a leading 0 infront of time if it there is a single digit before colon( : )
    Time
    08:00
    10:00
    01:00
    12:30
    09:00
    Create statement:
    Create table TimeTest(
    ID int null,
    Time char(7) null,
    Insert Statement:
    Insert into Timetest(ID,Time) Values (1,'8:00AM')
    Insert into Timetest(ID,Time) Values (2,'10:00AM')
    Insert into Timetest(ID,Time) Values (3,'1:00PM')
    Insert into Timetest(ID,Time) Values (4,'12:30PM')
    Insert into Timetest(ID,Time) Values (5,'9:00AM')
    Thanks,
    RH
    sql

     I guess it depends on what you really want.  If you really truly want the expected results you have listed above, which changes 1pm into 0100, instead of 1300, then you can do this:
    SELECT ID
    ,[Time]
    ,RIGHT(CAST(CAST(REPLACE(REPLACE(REPLACE([Time], 'AM', ''), 'PM', ''), ':', '') AS int) + 10000 AS varchar(5)), 4) AS [HHMM]
    FROM TimeTest
    However, if you do want to differentiate between 1:00PM and 1:00AM, making them 1300 and 0100 respectively, then just use the solution from
    Jingyang Li

  • How to output variable names and units used in binary file

    My colleague will be giving me binary files (*.dat) generated from within LabView. There are over 60 variables (columns) in the binary output file. I need to know the variable names and units, which I believe he already has set up in LabView. Is there a way for him to output a file containing the variable name and unit, so that I'll know what the binary file contains? He can create an equivalent ASCII file with a header listing the variable name, but it doesn't list the units of each variable.
    As you can tell I am not a LabView user so I apologize if this question makes no sense.
    Solved!
    Go to Solution.

    Hi KE,
    an ASCII file (probably csv formatted) is just text - and contains all data that is (intentially) written to. There is no special function to include units or whatever!
    Your collegue has to save those information the same way he saves the names and the values...
    (When writing text files he could use WriteTextFile, FormatIntoFile, WriteToSpreadsheetFile, even WriteBinaryFile could be used...)
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Muse crashes randomly when using the place file/image function. And is slow!

    Hi guys,
    I am using a MacBook Pro Retina i7 with 8GB ram. I installed the trail version of Adobe Muse and I am really liking the product so far, except that it crashes a lot, randomly, when I sometimes use the place file or place image function. (Command-D) Muse is also slow. I have little apps running, plenty of free space etc but Muse is sluggish, lags and crashes a lot.
    Is there a known reason for this? This is preventing me from considering to buy the program.
    Please help,
    Regards,
    Riaan

    Thank you for that.
    I will give it a try. Two things I noticed, I do have column view on, but sorted by type and then secondly I am placing images from my Google Drive and DropBox folder..
    Will report back once I have had a chance to test it again.

  • Pick and place using labview and Ni vision acquisitio​n

    Hi everyone,
    I am doing a student project  on Vision guided pick and place of an industrial robot(abb) . I would like to know the steps involved in creating the block.
    I have to locate the object , get its cooordinates through webcam. Then does a pattern matching.. and would send the cooordinates to microcontroller . then from microcontroller to robot controller.. then the industrial robot should pick the object and place it in a predefined place..
    I would be extremely grateful if you guys can help me since  I am new to LabView. 
    Thanks,
    Pradeep.M
    ( [email protected])
    Solved!
    Go to Solution.

    What you are describing is fairly involved, but here's are some tips.  The key is to correlate the robot's coordinate system to the camera's coordinate system.  I assume the camera is statically located above the pick-up area?  I would move the robot to each corner of the frame to its pick position vertically, and note the robot's position at those locations.  These 4 points in space will be correlated to the X,Y coordinates of the camera frame's pixels.  You basically need to write a sub-VI with the inputs being pixel X and Y coordinates, and the output being the robot coordinates.
    Write a test application telling the robot to go to any X,Y pixel location in the frame to test your sub-VI.  If that is working, then you need to set up a pattern match.  You will likely want to do a geometric pattern match.  Have a look at this example:  http://zone.ni.com/devzone/cda/epd/p/id/5555
    You will need your pattern match algorithm to return both the coordinates for your robot, and the orientation of the tool required to properly pick up the object (if the pick and place robot tool requires that it be in a specific orientation).  So its basically up to you to convert the object's X,Y,and rotation angle in the frame that you get from the pattern match to whatever coordinate system the robot uses.  
    The placing algorithm could just be a orientation adjustment to put the object into placement orentation, and then the placement positions could be an array of robot coordinates that you iterate through after each pick.
    Make sure to implement some safety mechanisms in your algorithms so that the robot can never move somewhere outside a safe range of coordinates.
    www.movimed.com - Custom Imaging Solutions

  • How to set a value to a Presentation Variable using GO URL?

    Hi All,
         I am working on a drill (GO URL) from Dashboard page1 to Dashboard page2.
         The problem I am facing is, I am not able to pass a value to the presentation variable through GO URL. (I have to pass "Customer Category" static
    value to The presentation variable present in Dashboard Page2 ).
         The Dashboard page2 is having a view select in which we are using presentation variable to select the report based on the value selected in
    View Select.
         For example: If the user selects "Customer Category" value in View select and clicks on GO button Customer Category report will show the out put.
         When i am drilling from Dashboard Page1 I have to pass a value to the presentation variable used in view select and also pass some filter condition in
         GO URL.
         Please let me know if it is feasible to pass a value to the presentation variable through GO URL in OBIEE 10.1.3.4.
         It will be greate if you can provide me with the syntax to set a value to the presentation variable of dashboard page2 through GO URL.
    Thanks and Regards,
    Sagar Vishwanathwar.

    1) You have to navigate to dashboard page, not to answer request = you have to use "Dashboard URL API" not GO URL API.
    2) On the target page, you have to place dashboard prompt, which sets required presentation variable.
    3) Refer to the target using Dashboard URL API and set filter on prompt column using URL parameters. Example: http://localhost:9704/analytics/saw.dll?Dashboard&PortalPath=%2Fusers%2Fadministrator%2F_portal&Page=page%201&Action=Navigate&P0=1&P1=eq&P2=D_TIME.YEAR_CODE&P3=%221996%22
    Do not forget to use Action=Navigate. The syntax for setting filters using url parameter is the same as for GO URL API described in Business Intelligence Presentation Services Administration Guide.
    This is the way, you can implement navigation to parametrized direct SQL reports including passing filter values...
    Regards K.

  • VS 2013 - SQL Server Projects - Can I Change defaults for SQL Servers to use and the paths to DB-files?

    Hi all,
    when a create a SQL Server Project using "File > New ...", I find the following settings defaulted:
    SQL Server is (local)\Version12.0 and
    DefaultDataPath, DefaultFileprefix and the DefaultFilename(s) for MDFs and LDFs point to the Project directory.
    Initial settings of file size and increments are also not settable but defaulted.
    Because my projects have to verify performance by testing with large volume of data, we have to use a different SQL Server with files stored on that Server. The Project settings have a button to changes DB properties, but these are not part of that
    dialog.
    So I spent some fruitless hours in vain to find a way to change the project's connection to my development SQL Servers.
    How to cope with that?
    Thanks in advance.
    Regards Uwe

    Hi Caillen,
    thanks for Your response. I have to apologize for being a little late with my answer. I'll try to clarify my case more precisely:
    This is surely a topic related to VS2013 handling new "SQL Server Database Projects". When one clicks "OK" the following steps are executed by VS2013 (surely controlled by standard templates or the like):
    VS2013 creates the new project in a selectable directory and uses the projectname as a subdirectory whre the directory elements (*.sqlproj, bin\, obj\) where  later all the *.sql are placed, too. This is normal and expected.
    VS2013 creates a new database with its DB-files
    and attaches it to "(localdb)\ProjectsV12". The name of the database is the name of the project. The path to the DB-files (*.mdf and ldf) and their sizes are also defaulted to small values. The DB-server and the
    path to the DB-files is taken from the registry (!) HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\SSDT\LocalDbDatabaseFilePaths. I don't know when and by what tools these values are set.
    The path to DB-Files is typically also the path to the projects. The (local)-server places all system database files in the User\<user-ID>\Appdata\.. tree. Which is OK for small databases. The templates extracts some data from the DB-file path and
    places it in the deployment SQLs to populate the SQLCMD variables DefaultDataPath, DefaultFileprefix and the DefaultFilename(s) which are generated when pressing "Executed" or "Debug" the project.
    My problem is that we have to test database performance with larger volumes of data (e.g. two million rows and more). These cannot be stored in the User-path but must be handled by some kind of professional DB-Manager on various storage devices. When everything
    is tested, the publishing function of VS2013 will extract the structure and you are done incl. all the performance taming things.
    The dialog from the project properties can change to a different Server, but that server does not know your project database. The server and the DB-Files should be specified by the developer before VS2013 creates the database.
    So  the right forum would be a forum, where people developing SQL Server solutions with VS2013 are reading the questions.
    Thanks again for your patience.
    Regards Uwe

Maybe you are looking for

  • Home network setup HELP

    Hi Firstly I cannot get my Linksys RE1000 to work with my network having tried the set up CD on 2 computers (mac and windows) The main router is a BT Home Hub 2.0 any suggestions Secondly this is what I am trying to achieve so help to do that would b

  • File Receiver cotent conversion

    All, we have an xml message of the following structure. <target> <data><name>j</name><title>manager</title></data> <data><name>j2</name><title>manager2</title></data> </target> While we write the output flat file using content conversion. There is an

  • FM Radio not work

    When I first got my MP3 Vision player, I was able to listen to the radio function with no problem. However, now when I try to listen to the radio function, I get this error message:? "antenna (headphones) is not connected". And I am not trying to lis

  • I want to make a reusable WebService control

    Simple question, I want to make a reusable control that implements a web service. This control has no visual elements. What is the best way / convention to handle this in a Flex-y way? MXML component, MXML module, ActionScript class?

  • Need Help with Cue Points/Custome Code

    So I've figured out that videos with a playback component need cue points in order to set up all the interactivity I want to use. The only way to make animated graphics, interactive graphs and text is to apparently create custom code, which I no zip