Please help me to write a function for this requirement!

Hi,
    I have created a stored procedure which accepts 2 input parameters (param1 & param2 ) and its output is 'Score'
Eg:
Exec uspScorecalculation StudentID,DeptID 
output: 85
Now, My requirement is , I want to populate this value as one of the columns in a 'Select' statement.
Can you please give me some input like how can i write a funtion to retrieve this score from the procedure and use it in the select statement?
I assume,  the funciton should pass the two parameters into the stored procedure 'uspScorecalculation'  and retreives the Score.
Can you please help me on this?
thanks!

>> I have created a stored procedure which accepts 2 input parameters (param1 & param2 ) and its output is 'Score' <<
We have no idea from this posting what this procedure does. No code. No spec. Only a vague, useless narrative. 
We do not put that silly “usp_” prefix on a proc name; this is one version of tibbling. When we wrote in FORTRAN I and II, we had to put “fn_” on user functions name. A procedure uses a “<verb>_<object>” format. Have you read ISO-11179 Standards
or any book on data modeling?  
EXEC Calculate_Something_Score student_id, dept_id; 
>> Now, My requirement is, I want to populate this value as one of the columns in a 'SELECT' statement. <<
Populate a column? We do not do that in a declarative language like SQL. The row with that column comes into existence all at once, and all the rows in the table come into existence all at once. This is a set-oriented language. 
>> Can you please give me some input like how can I write a function to retrieve this score from the procedure and use it in the SELECT statement? <<
NO! An SQL programmer will take the body of the procedure and replace the parameters with column names. It will be part of a SELECT statement and not a function call. We hate UDFs and other procedural constructs. 
Please post the code and DDL, if you want help. Your failure and rudeness in not following Netiquette only hurt yourself. Your mindset is still locking into 1960's FORTRAN, not SQL. 
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL

Similar Messages

  • HT201328 my iphone 4G buy from japan, i need to use in indonesian, please help me, i spent much money for this phone.....

    my iphone 4G buy from japan, i need to use in indonesian, please help me, i spent much money for this phone.....

    froggy_vic wrote:
    so even if your phone is unlocked you wouldn't be able to use it anywhere else.
    Absolutely not true. There is no difference, spec wise, between the iPhone sold in Japan & the GSM iPhone sold everywhere else. iPhones in Japan use UMTS 2100.

  • Please help me in finding the solution for this query

    Hi Experts,
    How could i print column name's second word in next line
    suppose am taking ename alias as "employee name"
    i want to print the second word "name" in next line
    like
    "Employee
    Name"
    Whats the way of writing this query
    Please help me out
    Thanks in Advance

    Hi,
    914618 wrote:
    WITH mydata AS
    SELECT 1 emp_id, 'John Smith' emp_name FROM DUAL UNION ALL
    SELECT 2 emp_id, 'Steve Jobs' emp_name FROM DUAL UNION ALL
    SELECT 3 emp_id, 'Larry Allison' emp_name FROM DUAL
    SELECT emp_id, emp_name
    FROM mydata;
    after executing the above query the o/p I am getting is in the normal format like EMP_ID and EMP_NAME
    not according to my requirement like
    Emp Emp
    Id NameWhat are the results you reaally want? Do you want this?
    `   EMP_ID SPLIT_NAME
             1 John
               Smith
             2 Steve
               Jobs
             3 Larry
               AllisonIf so:
    SELECT  emp_id
    ,      REPLACE (emp_name, ' ', CHR (10))     AS split_name
    FROM      mydata
    ;The results above are 3 rows, not 6.
    What results would you want if emp_name contained 3 or more words? For example, if you add this to the sample data:
    SELECT 9 emp_id, 'Aung San Suu Kyi' emp_name FROM DUAL UNION ALL

  • Please help me 2 find a Document for this jar file com.sap.workflow_api

    HI,
    I want to create a task in UWL using web dynpro application. For this I need to import the specified com.sap.workflow_api.jar jar file.
    This jar file is in our WEB AS Server
    path=
    server\c\usr\sap\W01\JC00\j2ee\cluster\server0\apps\sap.com\irj\servlet_jsp\irj\root\WEB-INF\portal\portalapps\com.sap.workflow.apps\lib
    I have browsed all over for a good document , i got just one link :
    http://help.sap.com/saphelp_nw70/helpdata/EN/46/94b9b2b321581ce10000000a1553f7/frameset.htm
    Could you help me out with a better document for This task and  I want the complete document for this particular jar file com.sap.workflow_api.jar.
    It wolud be very helpful if I could get it at the earliest.
    Regards,
    Boopathi M

    HI Ayyapparaj,
    I have converted my project to javadoc,but i don't get any document for specific class. only I got what ever method is avilable in our controller that corssponding method come over in the java doc.
    How can i get the document for specified IWorkflow interface ? this com.sap.workflow_api jar file has IWorkflow interface. I need to know how to use this IWorkflow interface.
    How to use javadoc tool ?
    Regards,
    Boopathi M

  • Please help me to form a xschema for this data

    basically my xml would contain callername,callerpassword,username,password,id as data.
    1)All the data input can only be strings.
    2)callername and callerpassword is always mandatory(required).
    valid options
    1)xml can contain callername,callerpassword,username,password
    2)xml input can be callername,callerpassword,guid
    3)xml input can be callername,callerpassword,username,password,guid.
    Any thing other than that is invalid xml for me can anyone help me generate xschema for this data

    here you go:
    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
         <xs:element name="callername" type="xs:string"/>
         <xs:element name="callerpassword" type="xs:string"/>
         <xs:element name="data">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="callername"/>
                        <xs:element ref="callerpassword"/>
                        <xs:choice>
                             <xs:sequence>
                                  <xs:element ref="username"/>
                                  <xs:element ref="password"/>
                             </xs:sequence>
                             <xs:choice>
                                  <xs:element ref="guid"/>
                             </xs:choice>
                             <xs:sequence>
                                  <xs:element ref="username"/>
                                  <xs:element ref="password"/>
                                  <xs:element ref="guid"/>
                             </xs:sequence>
                        </xs:choice>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="guid" type="xs:string"/>
         <xs:element name="password" type="xs:string"/>
         <xs:element name="username" type="xs:string"/>
    </xs:schema>

  • Please help how to design query to implement this requirement.

    Dear Expert,
    Here is what I have and what the requirement is:
    I have a InfoCube:
    Dimensions:
    1. Material
    2. Currency
    Key Figures:
    1. Qty
    2. Amount
    We want to get the Qty and Amount by Material, but use Currency to be the filter.
    It means for example, if the Currency have CNY for one material, we need to show all the Qty/Amount, not only Qty/Amount in CNY.
    So please help give some idea about how to design the query to implement this requirement.
    Thank you,
    Andy

    Hi Andy:
    To accomplish your requirement you need to do 2 things:
    1. Create a Variable for the Currency (to be used as the Target Currency not as a filter for the Characteristic itself).
    2. Use the Standard Currency Conversion for the Amount Key Figure (Conversion Tab).
    This way, while executing the report you can select any currency you want and all the amounts will be converted to that currency.
    Take a look at this paper:
    "How to... Use Variables for Currency Conversion"
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/287bab90-0201-0010-f48e-cc55b0cd13d0?quicklink=index&overridelayout=true
    A more detailed explanation can be found on this article provided by Ramakrishna Gattikoppula:
    "Currency Conversion in BI 7.0"
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a0d5bf96-b19b-2c10-e3b6-e2f12a3de99a?quicklink=index&overridelayout=true
    In summary, to work with the Standard Currency Conversion you need to define 4 things:
    - Exchange Rate Type.
    - Source Currency.
    - Target Currency.
    - Time Reference.
    Regards,
    Francisco Milán.
    Edited by: Francisco Milan on May 31, 2010 11:19 AM

  • How should i write a pcr for this requirement?

    Dear Friends,
           Can any tell me whether we can write a pcr in such a way that if the person resigns the company on any day after 15th his full absence quota(for that month) should be accrued.
          if yes can you tell me  
          what are the key decision parameters i have to use in writing the pcr.
            waiting for you kind reply.
    Regards,
    Sai Prasad.

    Hai Prasad,
    I can give you the logic, cannot write exact rules.
    While genegarting absence quota
    - Check for termination action using OUTWPMASSN
        - If yes
              Check for Action year current year. (HRS=YSAY, HRS?CURYR)
                  - If its equal to 0
                      Check for current month (HRS=YSAO, HRS?CURMO)
                           - if its equal to 0
                                  check for current day (HRS=YSAA, HRS?CURDY
                                        - if its >=15
                                             generate quota
                           - Exit
    (Note: for this logic you have to generate monthly quota)
    With regards
    Shyam V

  • Please help me figure out the reason for this error

    Hello I am trying to run the jar Gui file I got from http://www.cs.cmu.edu/~cmucam/cmucam2/downloads.html
    and am getting the following error:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no sserial in java.li
    brary.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at serialPort.<clinit>(serialPort.java:22)
    at SerialComm.<init>(SerialComm.java:50)
    at CameraSerial.<init>(CameraSerial.java:64)
    at MainWindow.<init>(MainWindow.java:620)
    at CMUcam2GUI.main(CMUcam2GUI.java:7)
    Can anyone figure out why I am getting this error? I am running it on a windows xp professional system.

    Yes you need the sserial native library (and no I do not know where to get it).

  • How to use time series functions for this requirement

    we are on OBIEE 11g (11.1.1.5)
    Any pointers and links are really helpful.
    I have a requirement where YTD sales are displayed in a column. We wan to compare that number to what that number was last year at the same time. Tried to use TODATE, AGO and it did not work.
    || used for column seperation below.
    ProductGroup || YTD Sales Rev||YTD Sales Rev 1 Year Ago||YTD Sales Rev 2 Years Ago
    Climate Solutions || 1.7 mil (1/1/2011 - 7/1/2011) || 1.45 mil (1/1/2010 - 7/1/2010) || 1.15 mil (1/1/2009 - 7/1/2009)
    Thanks in advance
    kris
    Edited by: user566193 on Aug 10, 2011 6:06 PM

    Kris,
    Basically you want to combine the 2 time series functions here i.e. TODATE & AGO.
    Here you go..
    You can create first a YTD logical column in BMM say YTD Sales Rev..Then create another logical column with calculation as AGO(YTD Sales Rev, YEARDIM, 1) or AGO(YTD Sales Rev, MONTHDIM, 12).
    Similarly, you create other measures...OBIEE 11g has time series function in Answers as well but I'd say try to create using RPD as you to calculate 1 logical column based on another. Better to push it on RPD side.
    Hope this helps

  • Please help me to write PCRs... can any body give on real time PCRs .......

    hi to all,
    can any one please help me to write the sample PCRs.

    hi thanks to that...
    but i need some simple PCRs from u r end ......
    please explain to me..
    u said that i need to learn operations and functions ..
    i know those but i don't know how to use it...
    i have had U000 schema material...
    but i am not understing .... it....
    so if u can explain the one or 2 sample PCRs so that i can develop with the help of them........
    waiting for u r soooooooooon replay.............
    bye
    ravi

  • Please help to re-write this query using exists or with

    Hi please help to re-write this query using exists or with, i need to write same code for 45 day , 90 days and so on but sub query condition is same for all
    SELECT SUM (DECODE (t_one_mon_c_paid_us, 0, 0, 1)) t_two_y_m_mul_ca_
    FROM (SELECT SUM (one_mon_c_paid_us) t_one_mon_c_paid_us
    FROM (
    SELECT a.individual_id individual_id,
    CASE
    WHEN NVL
    (b.ship_dt,
    TO_DATE ('05-MAY-1955')
    ) >= SYSDATE - 45
    AND a.country_cd = 'US'
    AND b.individual_id in (
    SELECT UNIQUE c.individual_id
    FROM order c
    WHERE c.prod_cd = 'A'
    AND NVL (c.last_payment_dt,
    TO_DATE ('05-MAY-1955')
    ) >= SYSDATE - 745)
    THEN 1
    ELSE 0
    END AS one_mon_c_paid_us
    FROM items b, addr a, product d
    WHERE b.prod_id = d.prod_id
    AND d.affinity_1_cd = 'ADH'
    AND b.individual_id = a.individual_id)
    GROUP BY individual_id)
    Edited by: user4522368 on Aug 23, 2010 9:11 AM

    Please try and place \ before and after you code \Could you not remove the inline column select with the following?
    SELECT a.individual_id individual_id
         ,CASE
            when b.Ship_dt is null then
              3
            WHEN b.ship_dt >= SYSDATE - 90
              3
            WHEN b.ship_dt >= SYSDATE - 45
              2
            WHEN b.ship_dt >= SYSDATE - 30
              1
          END AS one_mon_c_paid_us
    FROM  items           b
         ,addr            a
         ,product         d
         ,order           o
    WHERE b.prod_id       = d.prod_id
    AND   d.affinity_1_cd = 'ADH'
    AND   b.individual_id = a.individual_id
    AND   b.Individual_ID = o.Individual_ID
    and   o.Prod_CD       = 'A'             
    and   NVL (o.last_payment_dt,TO_DATE ('05-MAY-1955') ) >= SYSDATE - 745
    and   a.Country_CD    = 'US'

  • 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

  • PLEASE help!! I use Outlook for my email and the Mail App Icon in my dock was also storing all my emails. So, I tried to delete ONLY the emails in the Mail App but somehow (under Preferences maybe?) I also deleted all my emails in my Outlook inbox.

    PLEASE help!! I use Outlook for my email and the Mail App Icon that is in my dock, that I know nothing about, was also storing all my emails. So, I tried to delete ONLY the emails in the Mail App but somehow (under Preferences maybe?) I also deleted ALL my OUTLOOK emails in my inbox.  Can someone please please tell me if there is a way to get my Outlook inbox emails back OR EVEN the emails that were in my Mail app - because even tho I never use the Mail app, at least the emails would be there.
    When I was trying to delete the emails in my inbox for the Mail app - I followed THESE directions.  It did in fact clear my inbox for the Mail app.  But then I went to log on to my Outlook account and EVERY SINGLE EMAIL was gone.  And not in the Deleted box.  Just gone.  Here are the directions I followed that screwed everything up.  Please help.
    Top menu bar, Mail > Preferences > Accounts > Mailbox Behaviors.
    Uncheck "Store deleted messages on the server".
    At the drop list for "Permanently erase deleted messages when", choose "Quitting Mail".
    Next...
    Top menu bar, Mail > Preferences > General.
    At "When searching all mailboxes, include results from", uncheck "Trash".
    Select All = command A

    i found out my prob!
    here is what you do.
    go to the "system preferences" on your dock.
    click "software updates".
    click "installed software"
    if it shows something about a recent update about "EFI UPDATE, FIRMWARE, THUNDERBOLT" or anything like that, exit out of it.
    go to mail.
    click "mail" at the top.
    click "preferences...".
    find the account you are having trouble with, once you do, make sure its highlighted, then click the "-" at the bottom of the window (this will only effect that mail account, it will not effect your ical weather or not its synced thought that email account)
    hit the "+" (right next to the "-") and add your accout back!
    its something with that update that effected mail, i hope this works out for you, if not reply back

  • Can a one please help me turn off auto play for Facebook the option is no longer in my  General settings  why is this ?

    Can a one please help me turn off auto play for Facebook the option is no longer in my  General settings  why is this ?

    And yet the link you posted only tells you how to do it on the Facebook App for Android. Nothing about the Facebook page is mentioned at all, or how to do it on an iPhone.
    With that said, and assuming you have the most up to date version of the Facebook App, you can now turn the auto play feature Off within the Facebook App itself.  Tap on the "More" icon on the bottom right, then scroll down to Settings->Videos and Photos->Auto Play. If Smart auto-Play is on turn it off. Then you can set the check mark on "Never Play Videos Automatically" which is the same as Off.

  • I have downloaded Photoshop Elements 12.  When I doubleclick on icon, it says that sign in is required.  I click sign in and it says I am not connected to the internet. Please help!  I've been trying for 3 days.

    I have downloaded Photoshop Elements 12.  When I doubleclick on icon, it says that sign in is required.  I click sign in and it says I am not connected to the internet. Please help!  I've been trying for 3 days.

    Sign in, activation, or connection errors | CS5.5 and later

Maybe you are looking for

  • How to Cancel a Sale Order without cancelling the subsequent document.

    Dear All,              I want to cancel sale order but the sale order have a subsequent document is there is any soulution that when i cancel the sale order all the subsequent document, outbound delivery and invoice cancelled in jn\ust one step, if n

  • Can i use my apple id on two phones?

    Can i use my apple id on two phones?

  • I cant connect to WiFi on my iPod Touch 1G?

    I have had an iPod Touch 1G for quite some time now, but I recently upgraded the iOS firmware to 3.1.3, and I just noticed that I cant connect to wifi! Nothing is grayed out, but it cannot find any connections. Ive tried resetting my router and wifi

  • HP LaserJet 1100 with Extreme?

    Has anyone gotten the Extreme to recognize this old printer? It doesn't show up in AP Utility when I plug it into the Extreme. I installed the Bonjour Printer Wizard and it doesn't see it either. An Apple Expert on the phone said the printer was prob

  • Problem importing into FCPX from SD card

    Hi, I'm having a problem importing some videos from a micro SD card into FCPX.  It is some helmet camera footage shot at 720P @ 30fps.  It's a .mov file. My problem is when I go to the "import media" window, I can see the files on the import screen.