Please help by providing me the code

Dear All,
I want to send some message to each and every client sockets connected to the server whenever a response comes to a server from any of the client sockets connected to it.Please let me know how this can be done.
It is something like the message will be globally available to all whenever a message comes from any one of the client socket.
Thanks & regards,
Saibal

Hi...
You mean like a chat program right?
I cant give you code but this is how you can do this
you should create a new thread for each new connection your server socket accepts and the thread should be listning to the incomming messages through that connection when ever an message arrives you have to pass it to all the connection for this you must maintane a collection of OutputStreams created from each active connection to improve the performance you can also use multiple threads to send messages.

Similar Messages

  • PLEASE HELP ME TO MODIFY THE CODE !

    DATA:BEGIN OF I_PARTNER OCCURS 0,
           VBELN LIKE VBPA-VBELN,
           adrnr like vbpa-adrnr,
           kunnr LIKE vbpa-kunnr,
           PARVW LIKE VBPA-PARVW,
           post_code1 LIKE adrc-post_code1,
           po_box LIKE adrc-po_box,
           name1 LIKE adrc-name1,
           name2 LIKE adrc-name2,
           city1 LIKE adrc-city1,
           city2 LIKE adrc-city2,
           country LIKE adrc-country,
           street LIKE adrc-street,
           str_suppl1 LIKE adrc-str_suppl1,
           str_suppl2 LIKE adrc-str_suppl2,
           str_suppl3 LIKE adrc-str_suppl3,
           vtext like tpart-vtext,
           ADRNP LIKE VBPA-ADRNP,
          SMTP_ADDR LIKE ADR6-SMTP_ADDR,
         END OF I_PARTNER.
    SELECT
    VBPA~VBELN
    vbpa~adrnr
    VBPA~PARVW
    VBPA~KUNNR
    VBPA~ADRNP
    TPART~VTEXT
    FROM VBPA AS VBPA
    INNER JOIN TPART AS TPART
    ON VBPAPARVW EQ TPARTPARVW
    AND SPRAS = SY-LANGU
    INTO CORRESPONDING FIELDS OF TABLE I_PARTNER
    WHERE
    VBPA~VBELN EQ S_VBELN.
    WRITE:/
      i_partner-adrnr         under         'ADDRESS NUMBER',
      i_partner-vbeln         UNDER         'Order-No',
      i_partner-parvw         UNDER         'Partner-Type',
      I_PARTNER-VTEXT         UNDER         'Partner-Type description',
      I_PARTNER-KUNNR         UNDER         'Partner-no'.
      ULINE.
    endloop.
    HERE I AM GETTING ALL THE POSSIBLE PARTNER TYPES.
    I WANT TO GET THE OUT PUT ONLY WHEN THE PARTNER TYPE S ARE  'SP'  'BP' AND 'SH'.
    PLEASE HELP.....

    Hi,
    Both the answers are correct... iam just writing the code u needed..
    ranges : gr_partner for tablename-fieldname.
    initialization.
    gr_partner-sign = 'I'.
    gr_partner-option = 'EQ'
    gr_partner-low = 'SP'
    append gr_partner.
    gr_partner-sign = 'I'.
    gr_partner-option = 'EQ'
    gr_partner-low = 'BP'
    append gr_partner.
    gr_partner-sign = 'I'.
    gr_partner-option = 'EQ'
    gr_partner-low = 'SH'
    append gr_partner.
    SELECT
    VBPA~VBELN
    vbpa~adrnr
    VBPA~PARVW
    VBPA~KUNNR
    VBPA~ADRNP
    TPART~VTEXT
    FROM VBPA AS VBPA
    INNER JOIN TPART AS TPART
    ON VBPAPARVW EQ TPARTPARVW
    AND SPRAS = SY-LANGU
    INTO CORRESPONDING FIELDS OF TABLE I_PARTNER
    WHERE
    VBPA~VBELN EQ S_VBELN
    and vbpa~parvw in gr_partner.
    Regards,
    Nagaraj

  • I am using Adobe Pro 11 and on opening a pdf I am getting error 'Insufficient Data for an Image'. Please help and provide a workaround if the solution not there.

    Hi all,
    I am using Adobe Pro 11 and on opening a pdf I am getting error 'Insufficient Data for an Image'. Please help and provide a workaround if the solution not there.
    I have already set the preferences to for page view to low zoom settings, and page fit view settings, but it never opens the pdf. Please check and provide a solution asap.
    Thanks in advance!

    Most of the documents have sensitive info on them.  I will have to do some looking for some that i can share, but will get something to upload (dropbox) as soon as I can.
    Thanks for you help.

  • Please help me out with the function code of print option in module pool

    please help me out with the function code of print option in module pool, along with CASE condition.
    regards,
    asif

    Hi
    you can use the Function module
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
        destination            = 'LP01'                       "'Printer name
        list_name              = 'TEST'
        list_text              = 'SUBMIT ... TO SAP-SPOOL'
        immediately            = ' '
        line_size              = '2000'
        no_dialog              = 'X'             "pass space to Pop screen for Print option
      IMPORTING
        out_parameters         = wa_pri_params
        valid                  = w_valid.
    "next call below things
      NEW-PAGE PRINT ON NO DIALOG PARAMETERS wa_pri_params.
         "and try to Print the values inside the new-page
      NEW-PAGE PRINT OFF.
    Prabhudas

  • I forgot the code for my iPhone to access the Home screen I do , please help me try formatting the iphone but when I put in nfc mode and connect it to the pc recognizes it and everything when you try to format the error 3004 appears

    I forgot the code for my iPhone to access the Home screen I do , please help me
    try formatting the iphone but when I put in nfc mode and connect it to the pc recognizes it and everything when you try to format the error 3004 appears

    Hello polo-angulo,
    I apologize, I'm a bit unclear on the nature and scope of the issue you are describing. If you are saying that you are getting an error code (3004) when you try to restore your iPhone (because you could not remember your passcode), you may find the information and troubleshooting steps outlined in the following articles helpful:
    Resolve iOS update and restore errors in iTunes - Apple Support
    Get help with iOS update and restore errors - Apple Support
    Sincerely,
    - Brenden

  • Cannot activate my viber after i update to 6.1.3 iphone 3gs..can u please help me...the the code is ok but if i activate...its being error.

    cannot activate my viber after i update to 6.1.3 iphone 3gs..can u please help me...the the code is ok but if i activate...its being error.

    @theViberTeam .
    I'm having trouble with Viber.
    A few days ago, I accidentally uninstalled it on my IPhone 4, and reinstalled it later on..
    When I tried sending the activation code using the same cell phone number I had on Viber before It got uninstalled, I receive the code but when I try to put it in it keeps saying that I entered the wrong activation code, I click on the no code feature on the top right corner of Viber, it gives me a code, but when I put that code in it says the same thing ,that I have the wrong access code please try again, and so I researched on the internet and came up to this post, It said to uninstall viber and wait 24 hours to install it again, I waited 24hours and tried it again, but it STILL does the same thing. and... I even tried entering my other phone number, yet it does the same thing and shows me the same message that I entered the wrong access code....It is getting frustrating! May you please Help ME?! What can I do??

  • Please help me to find the sample code and schema for GetDBDateTime.zip fil

    Please help me to find the GetDBDateTime.zip and Guest_Book.zip files.
    Tks!

    Does this Help?
    http://www.oracle.com/technology/sample_code/products/ias/files/psp/GetDBDateTime/Readme.html
    Did you install Oracle9iAS ?

  • Please help me to complete this code

    import java.security.MessageDigest;
    import java.util.Map;
    import java.util.Scanner;
    public class PasswordService
       //The hash is to be formed using the SHA algorithm
       //to create a MessageDigest
       private final String algorithmName = "SHA";
       //Use a message digest to create hashed passwords
       private MessageDigest md = null;
       //We simulate a database of users using who have a login and password
       //as a key and value pair in a Map
       private Map<String, byte[]> userData;
       //complete the constructor
       public PasswordService()
         //TODO - intialize the class instance data
          //some dummy data - do not alter these lines
          addUser("daddy", "cool");
          addUser("nightflight", "topChat");
          addUser("boney", "2E5sxuSRg6A");
       public void showProvider()
          //TODO
       //Get the hash value for the provided string password.
         public byte[] getHash(String password)
          //TODO
          return null;
       public void addUser(String login, String password)
          //TODO
       public byte[] getPassword(String login)
          //TODO
          return null;
       public boolean checkLogin(String login, String password)
         // TODO
          return false;
       //This method is provided to perform a login from the command line
       public boolean doLogin()
          Scanner sc = new Scanner(System.in);
          System.out.println("Enter login please");
          String login = sc.next();
          System.out.println("Your password please");
          String password = sc.next();
          return checkLogin(login, password);
       public static void main(String[] args)
          int attempts = 0;
          showProvider();
          while(attempts < 4)
             boolean match = doLogin(); //request login and password
             System.out.println("match? " + match);
             attempts++;
    }

    please help me to complete this code
    void completeCode(Code code,Properties options) throws CodeCompletingException
    CodeCompleterFactory cf = CodeCompleterFactory.newInstance();
    CodeCompleter cc = cf.newCodeCompleter();
    cc.complete(code,options);
    }

  • PLEASE HELP ME TO FIND THE SOLUTION REGARDING "LOGICAL SYSTEM CHANGED"

    HAI EVERYBODY,
    PLEASE HELP ME TO FIND THE SOLUTION REGARDING "LOGICAL SYSTEM CHANGED" during the material master replication by using middleware parameters.
    step1 : i have taken SRM client 810 and named it as CHINNISRM
    step2 : i  have taken r3 client 810 and named it as CHINNIR3
    step3: During material master replication i maintained tables like crmconsum,crmrfcpar,crmparoltp in   r3   and smofparsfa in srm client and filtered the objects and loaded the objects through r3ac3,r3ac1,r3as.
    step4 : And later i have checked in r3 queues to activate the objects,but i have seen a message like  "LOGICAL SYSTEM CHANGED:SEE 588701".according to the oss instructions i have checked in CRMPRLS table in se16 in R3 .there i found out there is one logical client  named with T90CLNT810.
    oss :588701
    Solution
    There are different cases in which different forms of processing are
    required or where several options exist:
    - The logical system name of an R/3 Backend client was changed in
    current operation. In this case, the data hangs in the outbound
    queues of the R/3 Backend system as specified under point 1 of
    the symptom. In this case, the logical system name must be
    changed back to the original value. Then the outbound queues
    can be reactivated. If no data was transferred to the EBP/CRM
    server before the change, also a correctioin of the check table
    is possible.
    - The same logical system name was used again in a new client of
    an R/3 Backend system that was linked to the EBP/CRM server. In
    this case, the data is in the inbound queue of the EBP/CRM
    server with the exception GUID_FOR_LOGSYS_CHANGED. In this
    case, the queue entries which have status SYSFAIL must be rejected, however, not the entire queues. If the new client of  the R/3 Backend system you have linked has exactly the same
    data as the old client and if it is meant to replace the old
    client (that is, this was deactivated), also a correction of
    the check tables is possible. In this case, the inbound queues
    can be reactivated after the correction.
    oss:765018
    1. If the situation in your system corresponds to the situation described
    under "Reason and Prerequisites" and if symptom 1 occurs, you can
    delete the table entry from table CRMPRLS table (there is just one
    entry). Since there is no maintenance dialog for this table and you
    cannot maintain it using transaction SE16, you must use a report to
    delete it. This report is attached to this note as correction
    instructions.
    Create the report ZZ_DELETE_CRMPRLS in your system and copy the source
    code from the correction instructions. You cannot implement this
    source code using transaction SNOTE.
    You can use the report in every plug-in or plug-in basis system, even
    if it is not specified in the validity section.
    After you have run the report, you can trigger existing queues again
    in transaction SMQ1.
    2. If the situation in your system corresponds to the situation described
    under "Reason and prerequisite" and if symptom 2 occurs, you can
    delete the entry from table CRMMLSGUID (there is just one entry).
    Since there is no maintenance entry for this table and you cannot
    maintain it using transaction SE16, you must use a report to delete
    it. This report is attached to this note as correction instructions.
    If they do not yet exist, add the following messages to message class SMOF in your logon language:
    Message Message short text
    303 User &1 is not allowed to change table &2.
    304 User &1 IS not allowed to display table &2.
    305 Logical system &1 was not found in table &2.
    306 System error! The current client was not
    found in table T000.
    Create the report ZZ_DELETE_CRMMLSGUID in your system and copy the
    source code from the correction instructions. You cannot implement
    this source code using transaction SNOTE.
    You can use the report for every release of the CRM system, even if it
    is not specified in the validity section. The only exceptions are CRM
    releases with Support Package versions that are too low such as CRM
    Release 3.0 with Support Package 12.
    After you have run the report, you can trigger existing queues again
    in transaction SMQ1 of the R/3 back-end system or transaction SMQ2 of
    the CRM system.
    so what should i do to do the replication.please suggest me .untill and unless i solve my problem i cant move to the further activity.i hope you people can solve my problem.thanks in advance.
    thanks and best regards,
    n.chakradhar

    Hi chakradhar,
    Did you find a solution to your issue? We are facing a similar issue and looking to figure out how this can be resolved.
    BR// 420

  • Please help me transform this C++ code to java code....

    guys...please help me transform this C++ code to java code....please try to explain the code..thanks
    [program]
    #include <stdio.h>
    #define ALIVE 1
    #define DEAD 0
    #define SZ 33
    int stschk (int ,int );
    main()
    int s[SZ][SZ], i, j;
    for (i=0; i<sz; i++ ) s[0] = DEAD;
    for (j=0; j<sz; j++ ) s[0][j] = DEAD;
    s[0][1] = ALIVE;
    for (i=0; i<sz-1; i++) {
    for ( j=1;j<sz;j++ ) {
    s[i][j] = stschk(s[i][j-1],s[i+1][j];
    if(s[i][j-1]==ALIVE) printf("*");
    else printf(" ");
    printf("\n");
    int stschk(int s1,int s2)
    if(((s1==DEAD)&&(s2==ALIVE))||
    ((s1==ALIVE)&&(s2==DEAD))) return ALIVE;
    else return DEAD;

    Being picky, that's not C++, that's C. Standard headers in C++ dont' have .h after them, loop variables are scoped with the for, you use constants rather than #defines, etc..
    C and C++ both don't initialise arrays by default; you'd have to write an initialiser to get it to zero out the array:
        int s[sz][sz] = {};gcc will insert a call to memset to zero the array.
    If the author was assuming that the array was zeroed out, there would be no point zeroing the first row and column.
    The code reads values which haven't been initialised. If you mark such values explicitly undefined, and change the program to report an error when undefined, then you get several cases where the program makes such report.
    So either it' s a primitive random number generator (some random number generators use uninitialised memory as a source of randomness), or it's buggy, or it's processing undefined data and throwing away the result. Either way, it cannot be directly be ported to Java if the undefined values (which are limited to a small area of the ouput) are significant.

  • I forgot restrictions cod in ipad air1 and don't off it , please help me for recovery this cod

    i forgot restrictions cod in ipad air1 and don't off it , please help me for recovery this cod...

    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device: Several Alternative Solutions
    A
    1. iOS- Forgotten passcode or device disabled after entering wrong passcode
    2. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    3. Restoring iPod touch after forgotten passcode
    4. What to Do If You've Forgotten Your iPhone's Passcode
    5. iOS- Understanding passcodes
    6. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    7. iOS - Unable to update or restore
    Forgotten Restrictions Passcode Help
                iPad,iPod,iPod Touch Recovery Mode
    You will need to restore your device as New to remove a Restrictions passcode. Go through the normal process to restore your device, but when you see the options to restore as New or from a backup, be sure to choose New.
    You can restore from a backup if you have one from BEFORE you set the restrictions passcode.
    Also, see iTunes- Restoring iOS software.
    And also see How to Recover Forgotten iPhone, iPad Restrictions Passcode.

  • Please help me to know the answers

    Hi ALL,
    Please help me to know the answers
    What is the role of the container element in BPM?
    What  is the difference between Idoc and RFC adapter ? How to decide which one will be used?
    How to restart the adapter engine or J2ee engine?
    What is the role of wndows1 and windows2 in SXMB_MONI?
    Is it possible to see the message after mapping ?If it is possible how to check?
    Regards,
    Somenath

    Hi somenth,
    What is the difference between Idoc and RFC adapter ? How to decide which one will be used?
    A)in case of sender idoc means Sender IDOC adapter need not be configured because IDOC adapter
    lies in ABAP engine - IDOC adpter resides in Integration engine.
    Incase of receiver, whatever is the adapter, you need an adapter configuration and receiver
    agreement - from the IE, the xml msg need to be sent to pipeline of idoc adapter,
    so you need a recever agreement......
    IDOC #
    Idoc Adapter: The next most commonly used adapter is Idoc adapter for sending and receiving Idocs from SAP XI.
    The foremost step before configuring the idoc adapter is the system settings that have to be done
    Details:
    In the case where we encounter a standard IDOC provided by SAP or Situation where a mapping is available or
    an IDOC as well as a BAPI exits, the approach will be dependent on the specific integration scenarioo......
    for For example, options might be
    1) sending one IDOC at a time
    2) combing multiple IDOCS and sending as a single IDOC.
    3) making one single RFC call, for each business transation.
    4) avoiding multiple calls to the same BAPI / RFC by deploying a wrapper BAPI and sending all records in one call.
    5) Using the proxy and sending all data in one shot and making single calls to the BAPI from the proxy.
    proxy and rfc adapter #
    a proxy on the SAP application system should be used while interfacing with a standard BAPI or remote enabled
    function modules on the application system. the proxy will be invoked by SAP PI/XI and on the application system
    the proxy will call the BAPI. in SAP systems with WEB AS versions <6.20 the proxy option is not available and hence
    the RFC adapter should be used insted.
    Disadvantage:
    pre-built meta data and the mapping that SAP delivers will not be usefull as the BAPI is wrapped with a proxy.
    so if the pre-defined integration content is not taken into account the proxy should be used insted of configuring
    the RFC adapter and calling the BAPI / RFC
    Advantage:
    it bypasses the adapter engine and directly interacts with the application system and integration engine thereby
    enchancing the performance
    2 )What is the role of the container element in BPM?
    A)The workflow container contains an element which is defined with a data type reference to the same object type that is created in the referenced task, this binding definition is proposed automatically when an activity is defined.
    If no element with an appropriate data type reference is available in the workflow container, a suitable element is added to the workflow container and the binding entered.
    Defines the data for a business process and to enable data to be transferred between the individual steps of the business process.
    consists of an unlimited number of container elements.
    Container elements ( Variable declaration)
    Consists of a name to address data in the process
    Can be typed to
    *Simple XSD ypes :XSD:data,XSD:time,XSD:integer, XSD:string.
    *Abstract interface
    *Receiver
    *Can be multiline ( a vector of the types above)
    3)How to restart the adapter engine or J2ee engine?
      SMICM
    4)What is the role of wndows1 and windows2 in SXMB_MONI?
    Window1 and window2 will get you the message payload
    we can check the messages in SXMB_moni
    regards
    srinivas

  • Please help me to close the IF blocks.

    HI EXperts,
    Please help me on closing the IF blocks properly in the below procedure.
    CREATE OR REPLACE PROCEDURE sums_proc
                    Id INTEGER,
      mtrname VARCHAR2
                    mtrtype INTEGER,  
    AS
    state  VARCHAR2(10);
    accesslevel INTEGER;
    asts NUMBER;
    mtrtypesql LONG;
    sumsql LONG;
    BEGIN 
    SELECT st_name INTO state FROM states_info WHERE st_name  = 'KARNATAKA';
    SELECT acc_level INTO accesslevel FROM level_table WHERE level_id  = 4;
    IF (accesslevel = 4) THEN 
    BEGIN 
    asts :=4;
    END; 
    ELSIF (accesslevel = 3)  THEN
    BEGIN 
    IF (OBJECT_ID('CANN_TABLE') IS NOT NULL)  THEN
    BEGIN 
    EXECUTE IMMEDIATE 'DROP TABLE CANN_TABLE'; 
    END;
    EXECUTE IMMEDIATE 'CREATE TABLE CANN_TABLE'; 
    END;
    ELSE
    BEGIN  
    IF OBJECT_ID('MANN_TABLE') IS NOT NULL  THEN
    BEGIN 
    EXECUTE IMMEDIATE 'DROP TABLE MANN_TABLE'; 
    END;
    EXECUTE IMMEDIATE 'CREATE TABLE MANN_TABLE';
    END; 
    IF (mtrname IS NULL OR mtrname = '')  THEN
    mtrname := ''; 
    ELSE 
    mtrname := 'DEFAULT';
    IF (mtrtype > 2) THEN
    mtrtypesql := ' AND (mtr = 1) ' ; 
    ELSE  
    mtrtypesql := ' AND (mtr = 2) '; 
    END IF;
    IF (mtrtype = 1) THEN 
    BEGIN 
    mtrtypesql := 'SELECT SUM(amount) as amount FROM sales_table WHERE sales_type=''SALES''||mtrtypesql'; 
    END; 
    ELSIF (mtrtype = 2)
    mtrtypesql := 'SELECT SUM(amount) as amount FROM margin_table WHERE margin_type=''MARGIN''||mtrtypesql';  
    END; 
    IF (mtrtype = 4  OR mtrtype = 3) THEN
    BEGIN  
    mtrtypesql := 'SELECT SUM(amount) as amount FROM margin_table WHERE margin_type=''MARGIN''||mtrtypesql';
    END; 
    ELSIF (mtrtype = 10 OR mtrtype = 15) THEN
    BEGIN    
    mtrtypesql := 'SELECT SUM(amount) as amount FROM revenue_table WHERE revenue_type=''REVENUE''||mtrtypesql';
    END;        
    ELSE 
    BEGIN 
    mtrtypesql := 'SELECT SUM(amount) as amount FROM revenue_table WHERE all_type=''ALL''||mtrtypesql';
    END;
    sumsql := ' SELECT SUM(amount) FROM salesum_table';
    EXECUTE IMMEDIATE mtrtypesql || ' UNION all ' ||sumsql ;
    IF OBJECT_ID('CANN_TABLE') IS NOT NULL THEN
    BEGIN 
    EXECUTE IMMEDIATE 'DROP TABLE CANN_TABLE'; 
    END;
    END IF; 
    IF OBJECT_ID('MANN_TABLE') IS NOT NULL  THEN
    BEGIN 
    EXECUTE IMMEDIATE  'DROP TABLE MANN_TABLE'; 
    END;
    END;
    Please help me.
    Thanks.

    Hi,
    Thanks for your help.
    Please help on the error.
    ORA-24338: statement handle not executed
    CREATE OR REPLACE PROCEDURE sums_proc(
        p_Id      INTEGER,
        mtrname VARCHAR2 mtrtype INTEGER,
        P_out OUT SYS_REFCURSOR
    AS
      state       VARCHAR2(10);
      accesslevel INTEGER;
      asts        NUMBER;
      countval   NUMBER :=0;
      mtrtypesql LONG;
      sumsql LONG;
      v_query LONG;
      BEGIN
      SELECT st_name INTO state FROM states_info WHERE st_name = 'KARNATAKA';
      SELECT COUNT(*) INTO countval FROM  level_table WHERE level_id = p_id;
    IF countval = 0 THEN
    RETURN;
        ELSE
            SELECT access_id INTO accesslevel  level_table WHERE level_id = p_id;
        IF (NVL(accesslevel, 0) = 0)  THEN
        RETURN;
        END IF;
    END IF;
      IF (accesslevel = 4) THEN
      asts :=4;
      ELSIF (accesslevel = 3) THEN
        IF (OBJECT_ID('CANN_TABLE') IS NOT NULL) THEN   EXECUTE IMMEDIATE 'DROP TABLE CANN_TABLE';
         ELSE EXECUTE IMMEDIATE 'CREATE TABLE CANN_TABLE(SM NUMBER)';
        END IF;
      ELSE
       IF OBJECT_ID('MANN_TABLE') IS NOT NULL THEN   EXECUTE IMMEDIATE 'DROP TABLE MANN_TABLE';
        ELSE  EXECUTE IMMEDIATE 'CREATE TABLE MANN_TABLE(SM NUMBER)';
       END IF;
       IF (mtrname IS NULL OR mtrname = '') THEN  mtrname := '';
       ELSE
          mtrname      := 'DEFAULT';
         IF (mtrtype   > 2) THEN
            mtrtypesql := ' AND (mtr = 1) ' ;
          ELSE
            mtrtypesql := ' AND (mtr = 2) ';
         END IF;
         IF (mtrtype = 1) THEN
            mtrtypesql := 'SELECT SUM(amount) as amount FROM sales_table WHERE sales_type=''SALES'''||mtrtypesql;
          ELSIF (mtrtype = 2)
            mtrtypesql := 'SELECT SUM(amount) as amount FROM margin_table WHERE margin_type=''MARGIN'''||mtrtypesql;
          ELSIF (mtrtype = 4 OR mtrtype = 3) THEN
              mtrtypesql := 'SELECT SUM(amount) as amount FROM margin_table WHERE margin_type=''MARGIN'''||mtrtypesql;
          ELSIF (mtrtype = 10 OR mtrtype = 15) THEN
              mtrtypesql := 'SELECT SUM(amount) as amount FROM revenue_table WHERE revenue_type=''REVENUE'''||mtrtypesql;
          ELSE
              mtrtypesql := 'SELECT SUM(amount) as amount FROM revenue_table WHERE all_type=''ALL'''||mtrtypesql;
          END IF;
          sumsql := ' SELECT SUM(amount) FROM salesum_table';
          v_query :=||mtrtypesql || ' UNION all ' ||sumsql ||';
          OPEN P_out FOR v_query;
          COMMIT;
        END;
    My requirement is
    IF accesslevel = 0 or IF accesslevel is not existed the program should come out.
    SO that I have included the below code
    SELECT COUNT(*) INTO countval FROM  level_table WHERE level_id = p_id;
    IF countval = 0 THEN
    RETURN;
        ELSE
            SELECT access_id INTO accesslevel  level_table WHERE level_id = p_id;
        IF (NVL(accesslevel, 0) = 0)  THEN
        RETURN;
        END IF;
    END IF;
    I want to send the result set to front so that I have replaced the below statement with
    EXECUTE IMMEDIATE 'BEGIN INSERT INTO CANN_TABLE '||mtrtypesql || ' UNION all ' ||sumsql ||';
    OPEN P_out FOR v_query;
    If I get accesslevel as 0 I am getting error when executing thic procedure.
    ORA-24338: statement handle not executed
    Please help me.
    Thanks.

  • Please help me to build the logic

    Hi All,
    Please help me to implement the following logic.
    The conditional statements should not only be executed in sequence, but also if any of them are true they should not be overridden by any subsequent conditional statements being true.
    When actual effort Accepted or Rejected for AST proposals and calculate a flag for “enhance to AST guideline” = Y/N as follows for each employee and display at the employee level
    1)If AST eligibility = N AND proposed AST % >0, then “N”
    2)Else If AST eligibility = N AND proposed AST % = 0 then “n/a”
    3)Else If AST eligibility = Y AND Act Rank = 3 AND proposed AST = 0 then “Y”
    4)Else If AST eligibility = Y AND Act Rank = 3 AND proposed AST >0 then “N”
    5)Else If AST eligibility = Y AND Act Rank = 2 AND proposed AST = 0 then “Y”
    6)Else If AST eligibility = Y AND AST % is greater than or equal to the AST guideline minimum AND less than or equal to the AST guideline maximum, then “Y”
    7)Else If AST eligibility = Y AND AST % is less than the minimum guideline OR greater than the maximum guideline, then “N”
    I tried the following code but I am not getting the expected result .
    Could you Please help me to build the logic.
    Your earliest response is very helpful to me.
    if (upper(P_stat)='ACCEPTED' or upper(P_stat) like 'REJECTED%') then
    else if NVL(P_elgi,'N') <> 'Y' AND P_prop > '0' then
    P_flag := 'N';
    else if(NVL(P_elgi,'N') <> 'Y' AND P_prop = '0') then
    P_flag := 'N/A';
    else if ((NVL(P_elgi,'N')='Y') AND P_rank = '3' AND P_prop = '0') then
    P_flag := 'Y';
    else if((NVL(P_elgi,'N')='Y') AND P_rank = '3' AND P_prop > '0') then
    P_flag := 'N';
    else if((NVL(P_elgi,'N')='Y') AND P_rank = '2' AND P_prop = '0') then
    P_flag := 'Y';
    Else if (P_prop >=ast_min_guide AND P_prop <= ast_max_guide ) then
    P_flag := 'Y';
    else
    ((P_prop < ast_min_guide) OR (P_prop > ast_max_guide)) then
    P_flag := 'N';
    end if;
    end if;

    Thanks for ur quick responce .
    When actual effort Accepted or Rejected for AST proposals and calculate a flag for “enhance to AST guideline” = Y/N
    Once the above condition is satisfied we have to check for remaing conditions
    if (upper(P_stat)='ACCEPTED' or upper(P_stat) like 'REJECTED%') then
    once it is satisfies then we have to go for remaing conditions.
    how can we do it in CASE statement.
    1)If AST eligibility = N AND proposed AST % >0, then “N”
    2)Else If AST eligibility = N AND proposed AST % = 0 then “n/a”
    3)Else If AST eligibility = Y AND Act Rank = 3 AND proposed AST = 0 then “Y”
    4)Else If AST eligibility = Y AND Act Rank = 3 AND proposed AST >0 then “N”
    5)Else If AST eligibility = Y AND Act Rank = 2 AND proposed AST = 0 then “Y”
    6)Else If AST eligibility = Y AND AST % is greater than or equal to the AST guideline minimum AND less than or equal to the AST guideline maximum, then “Y”
    7)Else If AST eligibility = Y AND AST % is less than the minimum guideline OR greater than the maximum guideline, then “N”
    I tried the following code but I am not getting the expected result .

  • Please help me to solve the issue in my query.

    Hi All,
    Please help me to understand the mistake what i did in below query and help to resolve that.
    Actually i am trying to create a query to filter the records from db based on my input parameter.
       If my input parameter is 1(@showallrecords) then i need to show all the records which has the IsLatest as 1
       If my input parameter is 0(@showallrecords) then i need to show all the records which has the IsLatest as 0
    select * from tabel1 INNER JOIN tabel2    
    ON tabel1.KeyId = tabel2.KeyId 
    and (@showallrecords = 1 and tabel1.IsLatest = 1 )
    and (@showallrecords = 0 and tabel1.IsLatest = 0 )
    when i am executing the above query with the parameter @showallrecords = 1 ,db is returning 0 rows.If i am executing the above query after removed the last line and (@showallrecords = 0 and tabel1.IsLatest = 0 ) then records are coming.
    i understand that 1=0(last line) and the condition is not true.So its affecting the result.
    Please help me to solve this.

    select * from tabel1 INNER JOIN tabel2
    ON tabel1.KeyId = tabel2.KeyId
    WHERE (tabel1.IsLatest = @showallrecords Or @showallrecords=0)

Maybe you are looking for