Testing the content of à SELECT in a "IF THEN" statement

OK, here it is, I've done that :
declare
ex integer;
begin
select count(*) into ex from user_tables where table_name='XB0109070001';
if ex>0 then
insert into toto (a)values('OK, works !!');
end if;
end;
and that works fine.
but when I'm trying to do that in a procedure, I have to make some modifications and it doesn't work:
req:='select count(*) into ex from user_tables where table_name='''||ntable||'''';
execute immediate req;
if ex >0 then
req is declared as varchar2 ex as integer and ntable provide the name of the table to select on.
With this, I get the message 00905. 00000 - "missing keyword"
What's missing here ?

Try this
create or replace Procedure type_paiement
       journal   varchar2,
       an        varchar2,
       mois      varchar2
is
declare
    prefix_ntable varchar2(8);
    ntable        varchar2(12);
    i             integer;
    ex            integer;
    req           varchar2(256);
begin
    --execute immediate 'delete from xx_jk_mreg'; <<- Dont use dynamic sql here you dont need it.
    delete from xx_jk_mreg;
    prefix_ntable:='XB' ||journal ||an ||mois;
    for i in 1..100
    loop
      ntable :=prefix_ntable||lpad ( i,4,'0') ;
      --req :='select count(*) from user_tables where table_name=:1'; <<- again you dont need dynamic SQL here
      --execute immediate req into ex using ntable; --Lesson learned. Thx.
      select count(*) into ex
        from user_tables
       where table_name = ntable;
      if ex > 0
      then
        execute immediate 'insert into xx_jk_mreg (clie_code,journal,periode,origine)
                           select distinct c.code,
                                  lpad(:1,2,''0''),
                                  lpad(:2,4,''0''),
                                  :3
                             from '||ntable||' xb,
                                  dossier d,
                                  client c
                            where xb.cmpt=''4111''
                              and xb.doss =d.code
                              and c.code =d.clie'
          using journal, mois||an, ntable,  ; <<- Again use bind variables.
      end if;
    end loop;
end;
/Please use {noformat}..{noformat} tags to format your code. Its very hard to read unformatted code.

Similar Messages

  • Error when I run report RSCMST to test the content server.

    when I run report "RSCMST" to test the my content server.    I get the error:
    header        HTTP/1.1 401 Authorization Required
                  date: Fri, 05 Dec 2008 20:20:45 GMT
                  server: Apache/1.3.41 (Unix) SAPCS/640
                  x-servertime: 20:20:45
                  x-query: create&pVersion=0046&contRep=ZTEST001&docId=020D3949CA03445AE10000000A14022B&compId=data&docPro ..
                  t=rud&accessMode=c&authId=CN%3DCPJ&expiration=20081205142027&secKey=MIH3BgkqhkiG9w0BBwKggekwgeYC
                  x-serverdate: 2008-12-05
                  x-pversion: 0046
                  x-errordescription: URI signature has expired
                  x-serverid: server="content01.ivo.com.cn";serverPort="1090"
                  x-servertype: SAP HTTP Content Server
                  content-length: 752
                  connection: close
                  content-type: text/plain
                  ~remote_addr:
                  ~uri_scheme_expanded: NONE
    want                 201
    bad           401
    time              17.974
    It seems that the "bad 401" means a http error.    I do not know how to configure it ?
    my content server uses the maxdb,  and http is apache, they are all running on redhat linux ese 5
    who can give me some advices?  thanks

    Victor,
            Looks like a web server authentication issue. I suggest you raise this issue in a basis/ web application server forum,
    Sojan

  • WD ABAP: How to get the contents of selected table lines?

    Hi,
    I'm trying to figure out how to get the contents of table lines back from the UI. I display a table with several lines of data. The user selects some rows. I want to move the contents of the selected rows to another table. I have a context attribute, say DATA, with attributes FIELD1... FIELDn, using a DDIC structure. These are bound to the table UI element and the corresponding table columns. To get the selected rows, I use wd_context->get_selected_elements(). This works, but what I get from this method is references to if_wd_context_element. How do I know which row (row number = ?) this corresponds to? And how do I get the actual data? I want a structure with FIELD1 = value1 FIELD2 = value2 etc. My context attributes FIELD refer to table columns, but I'm looking for the table line...
    Can somebody help me?
    Thanks,
    Ira

    Hi Ira,
    wd_context->get_selected_elements() returns WDR_CONTEXT_ELEMENT_SET which is a table type of IF_WD_CONTEXT_ELEMENT. You can loop through the WDR_CONTEXT_ELEMENT_SET, get into variable say node_elelement which is of type ref to If_Wd_Context_Element. Then you could use the method GET_STATIC_ATTRIBUTES of If_Wd_Context_Element which returns a structure with values of all the attributes in the selected row.
    If you need the row number, while populating the node you could have an additional attribute called rowno and populate it correctly. When you select the data using method GET_STATIC_ATTRIBUTES, you would get the appropriate row number.
    Regards,
    Srini.

  • How the get the content of selected ALV cell??

    hello expert,
    after click one of the ALV lines, we want to get the cell content of this selected line? how to realize this? thanks/

    hi,
    it is pretty simple,
    in the methosd u declare for the click we use the events of the ALV.
    in that we have an attribute r_param.
    do this to get the value:
    FIELD-SYMBOLS:<l_value> TYPE ANY.
      ASSIGN r_param->index TO <l_value>.
    the clicked value will be in <l_value>.
    madhu.

  • Error While defining the content server

    Dear Folks,
    We are trying to define the content sever in our sever. It is required for integration of SAP with documentum. We are trying to define in below path.
    Cross-Application Components - Document Management - General data - Settings for storage systems - Maintain storage system -
    It already have DMS_C1 content repository with storage type R/3 database. We are creating a new content repository with storage type HTTP Content Server. We are giving below inputs.
    Vesion No. 0045, HTTP Server - (My machine's FQDN and port is 8080), HTTP script as - sap/bc/contentsever/300.
    After giving above inputs, if I click on test connection, I m getting error as Error in HTTP Access:IF_HTTP_CLIENT -> RECIEVE1 ICM_HTTP_CONNECTION_FAILED.
    If I define the HTTP content sever as sap-qas.vsnl.co.in (i.e. My quality servers host name) it works fine i.e. connection test goes OK. Does any one know how we can define the content server and what all steps required for the same?
    Thanks and Regards,
    Kedar

    Hi Kedar,
    YOu have to provide the details as fallows
    Storage type : HTTP content server
    Version no. : 45 (based on the content server version)
    HTTP server : <content server IP>
    Port Number of content server : 1090 (default port)
    HTTP Scrip : ContentServer/ContentServer.dll
    Once after these details you can check
    Also install the DBM gui in your local PC and add this content servers database (if the content server is on MAX DB) then you need to star it from the console or else use the command to start it once after the installation.
    /sapdb/programs/bin/dbmcli -d <SID> -u control,plmcont db_state - to check the database status
    /sapdb/programs/bin/dbmcli -d <SID> -u control,plmcont db_online - to start the database
    Thanks,
    Chaitanya

  • Testing JMS content conversion

    Hi Experts,
    I have a scenario MQ-->PI--ECC.
    MQ sends a flat file and there is JMS content conversion used in sender JMS channel. On MQ side channels are not yet setup. Now I need to test if JMS content conversion is working properly. I cannot test by triggering flat file from RWB.
    Is there a way I can trigger a file from any third party tools and test the content conversion. Do you have any suggestions to make this test possible.
    Thanks,
    Avinash.

    Hi Avinash
    One option is to create a temporary File/FTP sender channel and use it in the sender agreement replacing the JSM channel. In the File/FTP channel, use the MessageTransformBean to achieve content conversion. This way, you can test out the content conversion parameters, and once the JMS server is ready, you can just swap it.
    Rgds
    Eng Swee

  • Problem in Testing the Query Template

    Hi All,
      I created mysql connection in the Dataservers and connection status was successful.we created FixedQuery(Fixed Query is SQLQuery Template type) in the query template editor.when i am trying to test the sql query "select * from emp" it is not displaying any result template.But sql query is working fine we tested in MYSQL server console.
    please do the need ful
    Regards
    Srikanth M

    Hi,
    I written fixed sql query(select * from emp) in the  query tab,When i select the "Test" button one window is opening ,text/html selected  and submited "OK" button .It is not opening any result template in the browser.
    Regards
    Srikanth

  • Healing brush is not showing content-aware selection in CS5

    Help. The healing brush is no longer showing the content-aware selection in CS5. What is wrong here? Have I changed a setting that I am too inexperienced to know about?

    Well, duh! I thought I had done that. Thank you very much. I feel a bit embarrassed to be so inept.

  • Is there a way to select MULTIPLE tabs and then copy ALL of the the URLs and titles/or URLs+titles+HTML links? This can be done with the Multiple Tab Handler add on; However, I prefer to use a Firefox feature rather than download an add on. Thanks.

    Currently, I can copy ONE tab's url and nothing else (not its name). Or I can bookmark all tabs that are open. However, I'd like to have the ability to select multiple tabs and then copy ALL of the the URLs AND their titles/or copy ALL of the URLs+titles+HTML links? This can be done with the Multiple Tab Handler add on; when I download the add on, I get a message saying that using the add on will disable Firefox's tab features. I prefer to use Firefox features rather than download and use an add on. Is there a way to do this without an add on?

    Hi LRagsdale517,
    You should definitely be able to upload multiple files by Shift-clicking or Ctrl-clicking the files you want to upload. Just to make sure you don't have an old version of the service cached, please clear the browser cache and then log in to https://cloud.acrobat.com/files. After clicking the File Upload icon in the upper-right corner, you should be able so select multiple files for upload.
    Please let us know how it goes.
    Best,
    Sara

  • Stacked canvas view placed on the content canvas

    Hi to all,
    i am developed a one form ,i.e placed the stacked canvas view on the content convas.
    i create a two data block's with same table.
    one data block for content canvas and one for stacked canvas.
    in the content canvas i taken two fileds with scroll bar and remaining fields placed on the stacked canvas.
    these stacked canvas view put on the content canvas.it dispalying and
    executed succesfully.
    here i am getting one problem i am displying the 10 records at a time in both canvases.my requirment is placed on the
    cursor on the content canvas particular record scroll down then automatically show the same record details in stacked canvas and
    content canvas scroll bar is changed automatically stacked canvas scroll bar is changed.
    any one help me.........

    {quotei create a two data block's with same table.
    one data block for content canvas and one for stacked canvas.{quote}
    This is not necessary. Just create one data block and then assign the block items to your Content and Stacked canvases. You can display items in a data block on different canvases. By doing this, there is no need to write code to synchronize the records because they are part of the same data block so they will automatically scroll as you navigate through your records.
    Craig...

  • Can you ask the user to select a point?

    Is there a way in a javasript to ask the user to select a point and then get that information back as an X and Y value?
    Eric

    One way, if you have cs4, is have the user drop a color sampler. Then you could do something like this
    app.activeDocument.colorSamplers[0].position;// get the position
    app.activeDocument.colorSamplers[0].remove()// remove the sample

  • Save Dialog in Office Application does not set the Content Type to the one selected on Document Creation.

    We have a Library that supports 4 Content Types  ("Content Type 1","Content Type 2","Content Type 3","Content Type 4")
    The user clicks new and selects "Content Type 3"
    Word is started
    The user edits the document
    Clicks Save
    "Choose Content Type" dialog is shown set to the Content Type "Content Type 1" because the Document content type is ordered as First (which also means Default)
    What is expected is the "Choose Content Type" dialog to show "Content Type 3" as selected
    Any ideas?

    Hi,
    According to your description, there is a library with four content types, you create a document with one of the content types, click save button in Office application,
    then a “Choose Content Type” dialog will show up for selecting a content type.
    I tried to reproduce as below:
    1. Create a library with four content types;
    2. In the ribbon of this library, “FILES”->”New Document”->”Content Type 1”, then the Office application with the predefined template will be opened for editing;
    3. Click the “Save” button, choose the save path as the current library, click “OK” to finish the process;
    4. Refresh the library in browser, the newly created document appears there.
    In my test, there is no “Choose Content Type” dialog showing up when save the document in Office application.
    I would suggest you provide more details about how to reproduce this issue(screenshot would be better) for further research.
    Thanks
    Patrick Liang
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Patrick Liang
    TechNet Community Support

  • Script logic : determine the content of a variable according to a IF test

    Hello experts,
    I have the following need in a script logic
    determine the content of a variable according to a IF test
    For example I tried :
    *WHEN %ENTITY%
    *IS "CH20","CH30","ES10"
    *SELECT(%ENTITYPBPD%, "[ID]", "ENTITYCC", "[ID] = '%ENTITYCC_SET%_PBPD'")
    *ENDWHEN
    Syntax is correct but I get a query execution error (Error in WHEN/ENDWHEN structure)
    I guess it's because this when don't have any REC instructions.
    In other words, if the user selection at the package prompt step are CH20, CH30 or ES10
    the variable has to be selection_PBPD
    if another member is selected
    the variable has to take other value
    Hope I've made my need clear, and thanks in advance.
    G.

    Hi G,
    Will the *TEST_WHEN() statement work for this case?
    The way that it works is that if the condition evaluates to TRUE, then the subsequent WHEN...ENDWHEN is processed, else it is not.
    Have a look at Page 66 of "How To Use BPC Scripting Logic, Version 1.00, April 21, 2006" (It's a bit old but I use it a lot on our MS7.0 SP9 installation).
    Hope this helps.
    Regards
    Nick

  • When opening a word document, I get this:The table of contents is empty because none of the paragraph styles selected in the Document Inspector are used in the document. Is there a way to solve this?

    The table of contents is empty because none of the paragraph styles selected in the Document Inspector are used in the document.
    The above is what I get when I open a word document. Is there a way to solve this?

    Hmmm. Apply the styles?
    Peter

  • Selecting the content of XML element CS3(JS)

    Hi
    I am trying to select the whole content of XML Element.
    I am trying like this
    app.activeDocument.xmlElements[i].select();
    But it is not working.
    Regards
    Suresh

    A few hints:
    Perhaps your variable
    i i
    is not defined. If that's the case, give up trying to write code for this complicated job! XML is not the easiest part of ID to begin with. Starting with uninitialized variables and flagging that as an error (and complaining about that in a forum) is a beginners' blunder.
    If I run your script line with i set to 0, the first element of my XML structure is selected. I can see with my own eyes it works, because I have the XML Structure pane in ID open. If I click on the 2nd element there and run your script line, the top (= 0th) element is selected. Perhaps you didn't open the XML Structure view so you did not see it worked after all. Or perhaps you expected something
    i else
    to be selected -- the text content, maybe -- so you tag it as "error". That's a misinterpretation of what the XmlElement object is. Understandable, but still not an error. You can have lots of XmlElements without any text or other object associated. If it was your intention to select whatever the xml element contains, try working with the property 'xmlContent'. From its description I gather that sort-of does this alternative interpretation, i.e., you can select the
    i text
    which is pointed to by the element. Untried. But do read on.
    If I run your script with i = 1, I
    i do
    get an error, and it's perfectly valid too! "Object is invalid" -- well, of course it is. There is no other XML element at that level. An app.document.xmlelements entry always points to the
    i root
    of the XML, and you can only have one. Perhaps you expected #1 to be the next sub-element. Well, not so in the ID implementation -- as usual for almost all XML based structures, it's a tree. The "next" element is xmlElements[0].xmlElements[0], which you can check by changing your line to
    >app.activeDocument.xmlElements[0].xmlElements[0].select();
    and verifying the 2nd element from the top is selected in the XML Structure view.

Maybe you are looking for

  • TalkTalk box for youview?

    I am a new bt customer due to be activated next week with phoneline and unimited regular broadband. I am interested in recieving bt vision also but have not ordered it yet depending if i can get a definitive answer for my question,so..... I have a ta

  • How to run report from forms

    hi all, i have tried to run report from forms using below codig(got from online help) DECLARE      repid REPORT_OBJECT;      v_rep VARCHAR2(100);      rep_status varchar2(20);      v_host varchar2(100):= 'localhost'; v_port varchar2(10); v_parameter_

  • From List to Canvas

    Hi All, Just started out coding my first MIDP game and stumbled on a problem. To offer the user a choice I can use a List. I know what to do to create the list and handle its events. But after the list, I want to switch to a canvas to display the gam

  • Mac is crashing regularly, bringing me to a fresh login prompt

    I am on the latest update of Snow Leopard. It seems that if I leave the computer to go to the screensaver automatically, chances are that it may crash. I haven't changed my energy saver preferences for months - so if it is related to that it's not so

  • Packaging question ear file

    We have common classes that are used in all modules. These are available in several jars. The way we have packaged is that these jars are put in the ear file and the Manifest.mf of the web application wars reference these jar files. This does not see