Pass parameter name as table name

I tried to append a parameter name (area) to the name of the table through a stored procedure. As we're using CIS, the @area reference doesn't work -- instead we use ?. The SP is simple:
declare @sql nvarchar(2000)
set @sql = 'select 1,2,3 from table_'+@area+'where <condition 1>'
execute sp_execute @sql
Executing this SP shows up a long list of errors.
Any help is deeply appreciated.
  

Post the actual and complete procedure and not just the part you think is relevant.
Post at least some of the complete and actual error messages you have received.
Lastly I will assume that your code has been edited for posting.  Assuming you did not add any additional errors during this editing, then perhaps you simply need to add a space between the table name and your where clause. In other words, change
from table_'+@area+'where <condition 1>'
to
from table_'+@area+' where <condition 1>'
And as always, it would help you and your readers to post the actual string that you are attempting to execute.  Simple logic errors in assembling your string are difficult to diagnose when you don't actually "see" the executed statement. 

Similar Messages

  • Parameter name passed in Set Callable Statement

    Is it not possible to pass parameter name in the callable statement while using Oracle drivers for jk 1.4??
    Thanks!

    Is it not possible to pass parameter name in the callable statement while using Oracle drivers for jk 1.4??
    Thanks!

  • Error on passing paramter names longer than 16 char on portal import page

    After created a transport set, we used portal import page to import it.
    However, when we select that transport set and click "import", an 404 error occured right away. The url is:
    /pls/portal/PORTAL.wwutl_ui_export_import.import_eds
    When we check the Apache error logs, it seemed all parameter names that are longer than 16 characters in the page's html form were passed wrongly. Those characters
    after the 16th character of the parameters' names were some unreadable or wrong
    ones. For example, P_EXPLICIT_MODE_EDS was passed as P_EXPLICIT_MODE_ˆ„N to the
    backend pl/sql procedure and that's why there was a "SIGNATURE (parameter names)
    MISMATCH" error I think.
    My question is actually why the internal portal pages couldn't pass parameter
    names that are longer than 16 characters. Are there some settings wrong with
    the portal metadata database or oracle portal itself, or even our linux system? Was it because maybe we set the multilanguage-support for our portal?
    This error also happens in some other portal internal pages. Please help and you can also contact me at email: [email protected]
    Thanks a lot!

    Hi,
    Found a note explaining the significance of these errors.
    It says:
    "NZE-28862: SSL connection failed
    Cause: This error occurred because the peer closed the connection.
    Action: Enable Oracle Net tracing on both sides and examine the trace output. Contact Oracle Customer support with the trace output."
    For further details you may refer the Note: 244527.1 - Explanation of "SSL call to NZ function nzos_Handshake failed" error codes
    Thanks & Regards,
    Sindhiya V.

  • How to pass parameter for table name in  form6i.

    Hi ,
    I am facing the problem to pass parameter for table name in form6i.
    If any solution please infirm me earliest to my mail id.
    ([email protected])
    example:
    begin
    select ename into :ename
    from :tab_name
    where empno =7788;
    end;
    It gives error as bad bind variable 'tab_name'
    *** where :ename and :tab_name are form fields
    Thanking you,
    Balasaheb

    object name not taken as table --> what do u mean by
    this?
    Please be more clear..
    Regards
    PriyaI have two block. First block I am displaying all the table using user_objects table. Another block I want display, user which table selected, corresponding table all the records.

  • How to run a webdynpro multiple times by passing different parameters each time and save webpages with parameter name?

    Hi Experts,
    I am a BW consultant and new to webdynpro. Not sure how to run RSO_METADATA_REPOSITORY multiple times and by passing different parameter values each time(either taken from an a standard BW table or user provided - anything is fine) and build web pages with parameter name. Need help with direction on where to start.
    Let me step back and explain my requirement:
    In BW we have an object called transformation.
    One way of generating documentation for transformation is highlight transformation and press F1. Then its documentation will be opened as a local web page.
    I need these web pages for all transformations. This is my requirment.
    I came to know that RSO_METADATA_REPOSITORY is beeing used to generate this web page.
    The web link is something like below:
    http://ubw05.xxx.com:8005/SAP/BW/DOC/METADATA/?page=BW_O_D&SystemID=BWPCLNT100&ClassID=TRFN&ID=0KHR6J65AIIUTCJZEC093K6XDFV909PB&objectVersion=A&sap-language=EN&sap-client=100
    When i run this link seperately(not by selecting transformation and pressing F1) i need to enter login credentials to BW system.
    My challenges is how do i pass login credentials and multiple transformation IDs to generate multipe web pages with each page named by transformation ID?
    WHere to start? First of all is RSO_METADATA_REPOSITORY Webdynpro JAVA or webdynpro ABAP or can i use anything?
    Since it is beeing opened as local webpages i assume it is webdynpro JAVa is that correct?
    Thanks,
    Raghu

    hello,
    might be a problem with the version you are using.
    regards,
    the oracle reports team

  • Passing parameter to process chain - logical file name

    Hi,
    Is there a way to pass a parameter to a process chain? Iu2019m trying to define logical file name (via transaction FILE) allowing to point on physical files name containing a parameter to be defined at run time. Is it possible?
    Example, consider receiving file ending by a number representing its source system origin:
    Filename_1      (file coming from syst 1)
    Filename_2      (file coming from syst 2)
    As both file have the same structure I would like to specify a single datasource Filename_n and a single process chain in which I would set the parameter n at run time. Is there a way to implement that?
    I first thought about an Abap routine reading parameter in a table but than Filename_n canu2019t be treated in parallel u2026 Any other idea?
    Cheers,
    Benoit

    Hi Benoit,
    yes, it is possible to call the file paths with routine at infopackage.
    if you have only 2 file and file names are constant, then you can create 2 infopackages and keep thse two in process chain.
    Start
    I
    infopackage 1
    I
    Infopackage 2
    and from applcation sever, these files will be loaded.
    if upi have more files, you can write a routine at the selection of file path, in infopackage.
    Regards
    Daya Sagar

  • Pass column-name as a parameter to reports

    Hello,
    the code below calls a report. But now I want to sort the rows in the report. For example I have a text-item in my form-modul. If I type a column-name and press the button then the rows should be sorted in the report. Is it possible tp pass column-names as parameter to reports?
    DECLARE
    repid REPORT_OBJECT;
    v_rep VARCHAR2(100);
    rep_status VARCHAR2(20);
    BEGIN
    repid := find_report_object('STATIONSTOPOLOGIE');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,RUNTIME);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,CACHE);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'html');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'rep_oracle-dev');
    -- SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no pdeptno='||:dept.deptno);
    v_rep := RUN_REPORT_OBJECT(repid);
    rep_status := REPORT_OBJECT_STATUS(v_rep);
    WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
    LOOP
    rep_status := report_object_status(v_rep);
    END LOOP;
    IF rep_status = 'FINISHED' THEN
    WEB.SHOW_DOCUMENT('http://oracle-dev:8888/reports/rwservlet/getjobid'||
    substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=rep_oracle-dev','_blank');
    ELSE
    message('Error when running report');
    END IF;
    END;

    Hi,
    the work has been done in reports. You can use a lexical parameter in reports to add a condition for sorting to the query like:
    select .. from .. where ... &p_order.
    Then add another parameter to the report (for example p_param). Fill p_param via your interface in forms (SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER, ....) with the column name. Then build a report trigger like:
    if :p_param is null
    then
    :p_order:= null;
    else
    :p_order:= 'order by '||:p_param;
    end if;
    But have a look, that p_param can only get correct values.
    Rainer

  • Passing the name of a table to a procedure

    Can anyone tell me how you can pass the name of a table to a procedure ?
    I am trying to write a generic procedure that will have the table name and the fieldname passed to it :-
    as in :-
    Select Fieldname FROM Tablename;
    null

    Refere to the documentation of
    built in package dbms_sql.

  • Labview control caption passed as parameter name

    Hi,
    Why is the Caption of a Labview control, when the control is assigned as a terminal on the VI connector, passed to Teststand as the parameter name ?
    I would have expected the Label of the control to be the parameter name passed to Teststand.
    In the past I've used the control's Caption to locally modify the front panel text, and the Label is used to represent the data's\variables name.
    regards,
    Gary.

    Hi Gary,
    My name is Kevin and I am an Application Engineer at NIUK.
    The original idea was to show the caption (if not empty) of a control instead of the label in case the user decides to localized the control by modifying the caption which we can dynamically change. The LV adapter stores both the caption and the label. The caption is only shown if it is not empty.
    Changing the behavior to always show labels will not affect compatibility since we already store them. Most of the time, the label and the caption are the same and if they are not the same I don't see a problem with just showing the caption. I have never seen a VI that shows both the caption and the label at the same time and if the caption is different that is what it is shown instead of the label.
    kind Regards
    Kevin R
    Applications Engineer
    National Instruments UK&Ireland

  • How to pass parameter (tray name) to event handler for Trays?

    Hi,
         I've several UI tray elements in my view and all these elements are associated with the action onToggleTrays.
         I want to capture the name of the Tray and state of tray(expanded/collapsed).
         For this when I try to add parameters to this event handler method, through IWD ParameterPassing, I can add only the expanded property. I'm not able to add the UI element (tray name).
         Can you please suggest how to add/pass tray name and tray state to the event handler method?
    Regards
    Sagar Nanda

    create a parameter for the action OnToggle say "id".
    In wdDoModifyView get the reference of tray element and map its id to this parameter.
    IWDTray tray=(IWDTray)view.getElement("Tray1");
    tray.mappingOfOnToggle().addParameter("id",tray.getId());
    IWDTray tray2=(IWDTray)view.getElement("Tray2");
    tray2.mappingOfOnToggle().addParameter("id",tray2.getId());
    Hope it helps.

  • Script to stop running SQL Agent job without passing job name as a parameter

    Looking for script to stop running job and don’t want to pass job name as a parameter, any job which is in running state I want that to be stop/disable.
    I have script to disable all jobs however if any jobs are in running state my requirement is to stop that job immediately and gets disable.
    Rahul

    Try the below scripts and then apply script to disable all jobs.
    execute xp_cmdshell 'net stop sqlserveragent'
    execute xp_cmdshell 'net start sqlserveragent'
    Regards, RSingh

  • Using a parameter for a table name?

    In SQL Server, can you use a parameter for a table name?  I'm working with Visual C# and want to do something like this:
    SELECT MAX(ItemID) FROM @TableName;
    Can this be done?
    (Basically, I have three separate methods within a class--one for each table I have; and each one will perform the above query but on different table names.  I'd like to see if there is a way that I can have just one method that will allow me to specify
    the table name.)

    As pointed out in other posts, you can. But a more relevant question is whether you should.
    A table in a relational database is supposed to model a unique entity, and each column in the table is supposed to model a unique attribute. This is not always how it is, but it is from this model a relational database is designed.
    From this angle, having a dynamic table name does not really make sense for application code. (Administrative actions is a different story.) Think of it this way: have you ever wanted to make the class name dynamic in C#?
    Admittedly, it is different in .NET, because everything inherits from System.Object, but in a relational database there is no inheritence.
    Anyway, if you are using stored procedures, you should have one stored procedure per table. Physically, in the plan cache, there will be one query plan per table, no matter how you do it.
    If you are submitting SQL statements from your application, it is a different matter. In this case, I find it difficult to object if you have a class that performs generic actions against tables. Then you build the SQL string in the client code.
    However, no matter how you do it, you need to be careful to avoid SQL injection. We had the example:
    DECLARE @TableName nvarchar(50),@sqlCommand nvarchar(max)
      SET @TableName = ' ItemInformation'
      SET @sqlCommand = 'SELECT MAX(ItemID) FROM ' + @TableName
    EXEC (@sqlCommand)
    But what if we have:
      SET @TableName = ' sys.objects; SHUTDOWN WITH NOWAIT; --'
    As long as we do it in T-SQL, we can (and we should do!) this to prevent SQL injection:
      SET @sqlCommand = 'SELECT MAX(ItemID) FROM ' + quotename(@TableName)
    If you build your SQL strings in C#, you will need to employ other checks. There is only an issue if the user can inject data somewhere, but your generic class will not have knowledge of this, and must assume the worst.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to pass sicf name as a parameter frm webdynpro

    Hi All,
    I have created a properties file in which i hv provided the following path: servername:port n path to open the SAP R/3 easy access but i want to pass sicf name so it directly opens it in portal.   Please provide me some assistance. Thankyou.
    Regards,
    Jaspreet Kaur
    Edited by: Jaspreet Kaur on Dec 29, 2008 11:56 AM

    Hi Jaspreet,
    You can create an IAC iview with your service.
    Hope this helps,
    Ivá

  • Unable to create foreign key: InvalidArgument=Value of '0' is not valid for 'index'. Parameter name: index

    I am running an SQL(CE) script to create a DB. All script commands succeed, but the DB get "broken" after creating the last costaint: after running the script, viewing table properties of Table2 and clicking on "Manage relations" gives the following error: Unable to create foreign key: InvalidArgument=Value of '0' is not valid for 'index'. Parameter name: index. Wondering what does that refer to...
    Here it is the script. Please note that no error is thrown by running the following queries (even from code that passing the queries by hand, one-by-one to sql server management studio).
    CREATE TABLE [table1] (
    [id_rubrica] numeric(18,0) NOT NULL
    , [id_campo] numeric(18,0) NOT NULL
    , [nome] nvarchar(100) NOT NULL
    GO
    ALTER TABLE [table1] ADD PRIMARY KEY ([id_rubrica],[id_campo]);
    GO
    CREATE UNIQUE INDEX [UQ__m_campi] ON [table1] ([id_campo] Asc);
    GO
    CREATE TABLE [table2] (
    [id_campo] numeric(18,0) NOT NULL
    , [valore] nvarchar(4000) NOT NULL
    GO
    ALTER TABLE [table2] ADD PRIMARY KEY ([id_campo],[valore]);
    GO
    ALTER TABLE [table2] ADD CONSTRAINT [campo_valoriFissi] FOREIGN KEY ([id_campo]) REFERENCES [table1]([id_campo]);
    GO
    Sid (MCP - http://www.sugata.eu)

    I know this is kind of old post, but did this realy solved your problem?
    I'm getting this same error message after adding a FK constraint via UI on VS2008 Server Explorer.
    I can add the constraint with no errors, but the constraint is not created on the DataSet wizard (strongly typed datasets on Win CE 6) and when I click "Manage Relations" on the "Table Properties" this error pop out:
    "InvalidArgument=Value or '0' is not valid for 'index'.
    Parameter name: index"
    Even after vreating my table with the relation in SQL the same occurs:
    CREATE TABLE pedidosRastreios (
        idPedidoRastreio INT NOT NULL IDENTITY PRIMARY KEY,
        idPedido INT NOT NULL CONSTRAINT FK_pedidosRastreios_pedidos REFERENCES pedidos(idPedido) ON DELETE CASCADE,
        codigo NVARCHAR(20) NOT NULL

  • Passing the Dynamic Internal Table as the Output Parameter of the FM...

    Hi,
    How can we pass the internal table as the output from the Function Module TABLES parameter.
        SELECT * FROM TVRO BYPASSING BUFFER INTO TABLE <ltable>.
    Now I need to pass the dynamic internal table <ltable> as the output in the function module.
    Thanks!
    Puneet.

    I can't use TVRO as the table type. The Table name is as the Input. This program will download the contents of the table and create an app server file. It can be for any database table.
    so i want the output of this FM should be the data from that table. So what should be the TABLE type.
    like in  a program i will use:::
      FIELD-SYMBOLS: <ltable> TYPE ANY TABLE,
                     <l_line> TYPE ANY,
                     <l_field> TYPE ANY.
        SELECT * FROM (p_table) BYPASSING BUFFER INTO TABLE <ltable>.
    That is my requirement.

Maybe you are looking for