How to convert this SQL query to PL/SQL

I basically need to create an anonymous block that will display each student's first name, last name and the count of students who scored less on test 1 than the student.
So basically we need to find the count of students who have scored less than that particular student and we do it for all students in the table.
So for this particular query i designed my code in SQL
select g1.gr_fname, g1.gr_lname, count(*)
from grade g1, grade g2
where g1.gr_t1 > g2.gr_t1 and
g1.std_code = g2.std_code
group by g1.gr_fname, g1.gr_lname;
But i am unable to get the logic as to how to execute it in PL/SQL,I am missing something a minor detail to execute the same in PL/SQL
could someone please help me with the logic.
Thanks

Hi welcome to the forum try some thing below
SQL> DECLARE
  2     CURSOR c1
  3     IS
  4        SELECT   ename, sal, d.deptno
  5            FROM scott.emp e, scott.dept d
  6           WHERE e.deptno = d.deptno
  7        GROUP BY ename, sal, d.deptno;
  8  BEGIN
  9     FOR c2 IN c1
10     LOOP
11        DBMS_OUTPUT.put_line ('name is  ' || c2.ename);
12     END LOOP;
13  END;
14  /
name is  CLARK
name is  KING
name is  JONES
name is  MARTIN
name is  FORD
name is  SCOTT
name is  ALLEN
name is  TURNER
name is  WARD
name is  MILLER
name is  ADAMS
name is  BLAKE
name is  JAMES
name is  SMITH
PL/SQL procedure successfully completed.This is just to demonstrate the use of PL/SQL block

Similar Messages

  • Re: How to converting from PL/SQL query to T-SQL query

    How to converting from PL/SQL query to T-SQL query... Its Urgent

    Download the
    SQL Server Migration Assistant for Oracle.  It will convert whole Oracle databases, or single queries or PL/SQL stored procedures.
    With caution that If your database is using Collation which is case sensitive SSMA will not work.SSMA doesnt guarantees 100% for conversion of Queries/stored proc /database if it fails to do so for some queries you will have to do it manually.
    But you can try
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • How to convert epoch time to datetime in sql*loader Oracle

    Hello,
    I wan't to question how to convert epoch time to datetime in sql*loader Oracle. I try this script for convert epoch time to datetime in sql*loader, but error:
    Record 1: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 2: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 3: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    This is my loader:
    LOAD DATA INFILE 'C:\Documents and Settings\Administrator\My Documents\XL_EXTRACT_211\load.csv'
    into table TEMP_TEST_LANGY append
    FIELDS TERMINATED BY ','
    TRAILING NULLCOLS
    DATADATA CHAR "TO_DATE('01-JAN-1970','DD-MON-YYYY')+:datadata/86400"
    This is my csv file:
    79314313.7066667
    79314336.2933333
    79314214.3466667
    This is my table:
    CREATE TABLE TEMP_TEST_LANGY
    DATADATA DATE
    Thanks
    Edited by: xoops on Sep 21, 2011 8:56 AM
    Edited by: xoops on Sep 21, 2011 8:58 AM

    thanks for your answer, but I asked to use sql loader instead of the external table, which so my question is why can not the epochtime converted to datetime, if there is no way to convert a datetime epochtime using sql loader, so I'm required to use the external table. thank you.
    This is my error log:
    Column Name Position Len Term Encl Datatype
    DATADATA FIRST * , CHARACTER
    SQL string for column : "TO_DATE('1-Jan-1970 00:00:00','dd-MM-YYYY hh24:mi:ss') + (:DATADATA/60/60/24)"
    Record 1: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 2: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 3: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Edited by: xoops on Sep 21, 2011 12:33 PM

  • How to convert string to an integer in SQL Server 2008

    Hi All,
    How to convert string to an integer in sql server,
    Input : string str="1,2,3,5"
    Output would be : 1,2,3,5
    Thanks in advance.
    Regards,
    Sunil

    No, you cannot convert to INT and get 1,2,3 BUT you can get
    1
    2
    3
    Is it ok?
    CREATE FUNCTION [dbo].[SplitString]
             @str VARCHAR(MAX)
        RETURNS @ret TABLE (token VARCHAR(MAX))
         AS
         BEGIN
        DECLARE @x XML 
        SET @x = '<t>' + REPLACE(@str, ',', '</t><t>') + '</t>'
        INSERT INTO @ret
            SELECT x.i.value('.', 'VARCHAR(MAX)') AS token
            FROM @x.nodes('//t') x(i)
        RETURN
       END
    ----Usage
    SELECT * FROM SplitString ('1,2,3')
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to convert this 'CAPITAL' in to small letter 'capital.'

    Hi All,
    I have a variable wk_text = 'CAPITAL'.
    How to convert this 'CAPITAL' in to small letter 'capital.'

    Hi,
    Use like below code.
    DATA text TYPE string.
    text = `Careful with that Axe, Eugene`.
    TRANSLATE text TO UPPER CASE.
    Regards,
    Pravin

  • How to convert the following query to sql server 2005

    hi
    i have the following query in ms access and i want to convert it into sql server 2005 express edition
    SELECT iif(Max(BNo) is null,1,Max(BNo)+1) AS BNo from ( SELECT iif(Max(Product.BNo) is null,0,Max(Product.BNo)) AS BNo FROM Product union all SELECT iif(Max(grndetail.BNo) is null,0,Max(grndetail.BNo)) AS BNo FROM grndetail UNION ALL SELECT iif(Max(srdetail.BNo) is null,0,Max(srdetail.BNo)) AS BNo FROM srdetail ) as t
    how to do this

    The construct involving case when MAX sounds suspicious. Can you explain what the query is supposed to be doing, the structure of your table, then we can re-write it?
    E.g. if you provide your table, some data and desired result, you'll get better answer than direct translation of this suspicious query.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How to convert milliseconds to date format in sql query

    Hi All,
    The following code is in java.     
    String yourmilliseconds = "1316673707162";**
    Date resultdate = new Date(Long.parseLong(yourmilliseconds));
    could you plese tell me how to convert milliseconds into date format in query and comparing with another date like(sysdate-3)

    Hello,
    http://stackoverflow.com/questions/3820179/convert-epoch-to-date-in-sqlplus-oracle
    Regards

  • How to convert from ifs date format to sql based dates

    I want to write a sql query using dates, to search an ifs
    database. Ifs stores dates as numbers created using the
    java.util.Date class. These dates are accurate to seconds.
    PLSQL uses a different format.
    What I need is a PLSQL function that converts PLSQL date format
    to and from the java.util.date format.
    This is an example of what I would like to do.
    String classname = "DOCUMENT";
    String whereclause = "CREATEDATE > theNeededFuction(to_date('01-
    Jan-2001', 'DD-Mon-YYYY'),'j')";
    Selector mySelector = new Selector(login.getSession());
    mySelector.setSearchClassname(classname);
    mySelector.setSearchSelection(whereclause);
    I do realize that I could simply convert the date in java, but
    in the long run, I want to use the oracle tools that support
    busness day calulations.
    -Mitch

    Hi Mitch - our ViewSpecification functionality automatically
    includes an Oracle Date column, which is derived from the java
    date values we store. These views are the supported way of
    performing read-only operations against an iFS instance.
    For yor reference, the Oracle date column is derived using the
    following SQL operation (e.g. for createdate):
    to_date('01-JAN-1970', 'DD-MON-YYYY') + (createdate/86400000)
    regards,
    dave

  • How to convert this Servlet into JSP

    I am trying to convert this Servlet into JSP page.
    How do I go about doing this?
    Thanks.
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.text.*;
    /** Shows all items currently in ShoppingCart. Clients
    * have their own session that keeps track of which
    * ShoppingCart is theirs. If this is their first visit
    * to the order page, a new shopping cart is created.
    * Usually, people come to this page by way of a page
    * showing catalog entries, so this page adds an additional
    * item to the shopping cart. But users can also
    * bookmark this page, access it from their history list,
    * or be sent back to it by clicking on the "Update Order"
    * button after changing the number of items ordered.
    * <P>
    * Taken from Core Servlets and JavaServer Pages 2nd Edition
    * from Prentice Hall and Sun Microsystems Press,
    * http://www.coreservlets.com/.
    * &copy; 2003 Marty Hall; may be freely used or adapted.
    public class OrderPage extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    HttpSession session = request.getSession();
    ShoppingCart cart;
    synchronized(session) {
    cart = (ShoppingCart)session.getAttribute("shoppingCart");
    // New visitors get a fresh shopping cart.
    // Previous visitors keep using their existing cart.
    if (cart == null) {
    cart = new ShoppingCart();
    session.setAttribute("shoppingCart", cart);
    String itemID = request.getParameter("itemID");
    if (itemID != null) {
    String numItemsString =
    request.getParameter("numItems");
    if (numItemsString == null) {
    // If request specified an ID but no number,
    // then customers came here via an "Add Item to Cart"
    // button on a catalog page.
    cart.addItem(itemID);
    } else {
    // If request specified an ID and number, then
    // customers came here via an "Update Order" button
    // after changing the number of items in order.
    // Note that specifying a number of 0 results
    // in item being deleted from cart.
    int numItems;
    try {
    numItems = Integer.parseInt(numItemsString);
    } catch(NumberFormatException nfe) {
    numItems = 1;
    cart.setNumOrdered(itemID, numItems);
    // Whether or not the customer changed the order, show
    // order status.
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String title = "Status of Your Order";
    String docType =
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
    "Transitional//EN\">\n";
    out.println(docType +
    "<HTML>\n" +
    "<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
    "<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<H1 ALIGN=\"CENTER\">" + title + "</H1>");
    synchronized(session) {
    List itemsOrdered = cart.getItemsOrdered();
    if (itemsOrdered.size() == 0) {
    out.println("<H2><I>No items in your cart...</I></H2>");
    } else {
    // If there is at least one item in cart, show table
    // of items ordered.
    out.println
    ("<TABLE BORDER=1 ALIGN=\"CENTER\">\n" +
    "<TR BGCOLOR=\"#FFAD00\">\n" +
    " <TH>Item ID<TH>Description\n" +
    " <TH>Unit Cost<TH>Number<TH>Total Cost");
    ItemOrder order;
    // Rounds to two decimal places, inserts dollar
    // sign (or other currency symbol), etc., as
    // appropriate in current Locale.
    NumberFormat formatter =
    NumberFormat.getCurrencyInstance();
    // For each entry in shopping cart, make
    // table row showing ID, description, per-item
    // cost, number ordered, and total cost.
    // Put number ordered in textfield that user
    // can change, with "Update Order" button next
    // to it, which resubmits to this same page
    // but specifying a different number of items.
    for(int i=0; i<itemsOrdered.size(); i++) {
    order = (ItemOrder)itemsOrdered.get(i);
    out.println
    ("<TR>\n" +
    " <TD>" + order.getItemID() + "\n" +
    " <TD>" + order.getShortDescription() + "\n" +
    " <TD>" +
    formatter.format(order.getUnitCost()) + "\n" +
    " <TD>" +
    "<FORM>\n" + // Submit to current URL
    "<INPUT TYPE=\"HIDDEN\" NAME=\"itemID\"\n" +
    " VALUE=\"" + order.getItemID() + "\">\n" +
    "<INPUT TYPE=\"TEXT\" NAME=\"numItems\"\n" +
    " SIZE=3 VALUE=\"" +
    order.getNumItems() + "\">\n" +
    "<SMALL>\n" +
    "<INPUT TYPE=\"SUBMIT\"\n "+
    " VALUE=\"Update Order\">\n" +
    "</SMALL>\n" +
    "</FORM>\n" +
    " <TD>" +
    formatter.format(order.getTotalCost()));
    String checkoutURL =
    response.encodeURL("../Checkout.html");
    // "Proceed to Checkout" button below table
    out.println
    ("</TABLE>\n" +
    "<FORM ACTION=\"" + checkoutURL + "\">\n" +
    "<BIG><CENTER>\n" +
    "<INPUT TYPE=\"SUBMIT\"\n" +
    " VALUE=\"Proceed to Checkout\">\n" +
    "</CENTER></BIG></FORM>");
    out.println("</BODY></HTML>");
    }

    Sorry.
    actually this is my coding on the bottom.
    Pleease disregard my previous coding. I got the different one.
    My first approach is using <% %> around the whole doGet method such as:
    <%
    String[] ids = { "hall001", "hall002" };
    setItems(ids);
    setTitle("All-Time Best Computer Books");
    out.println("<HR>\n</BODY></HTML>");
    %>
    I am not sure how to break between code between
    return;
    and
    response.setContentType("text/html");
    Here is my coding:
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException
         String[] ids = { "hall001", "hall002" };
         setItems(ids);
         setTitle("All-Time Best Computer Books");
    if (items == null) {
    response.sendError(response.SC_NOT_FOUND,
    "Missing Items.");
    return;
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String docType =
    "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
    "Transitional//EN\">\n";
    out.println(docType +
    "<HTML>\n" +
    "<HEAD><TITLE>" + title + "</TITLE></HEAD>\n" +
    "<BODY BGCOLOR=\"#FDF5E6\">\n" +
    "<H1 ALIGN=\"CENTER\">" + title + "</H1>");
    CatalogItem item;
    for(int i=0; i<items.length; i++) {
    out.println("<HR>");
    item = items;
    if (item == null) {
    out.println("<FONT COLOR=\"RED\">" +
    "Unknown item ID " + itemIDs[i] +
    "</FONT>");
    } else {
    out.println();
    String formURL =
    "/servlet/coreservlets.OrderPage";
    formURL = response.encodeURL(formURL);
    out.println
    ("<FORM ACTION=\"" + formURL + "\">\n" +
    "<INPUT TYPE=\"HIDDEN\" NAME=\"itemID\" " +
    " VALUE=\"" + item.getItemID() + "\">\n" +
    "<H2>" + item.getShortDescription() +
    " ($" + item.getCost() + ")</H2>\n" +
    item.getLongDescription() + "\n" +
    "<P>\n<CENTER>\n" +
    "<INPUT TYPE=\"SUBMIT\" " +
    "VALUE=\"Add to Shopping Cart\">\n" +
    "</CENTER>\n<P>\n</FORM>");
    out.println("<HR>\n</BODY></HTML>");

  • How do i get a output in CSV of a SQL query executed via SQL Command prompt

    Hi All,
    I have a question with reference to SQL command prompt. I have a sql query which runs properly and gives proper execution in SQL Management console in GUI.
    This report is used to pull the free disk space report of our servers
    As i want to schedule it as a report so i want to script it to run via SQL command prompt. I made the script and it works fine if i enter it in SQL command prompt. When i try to extract the output to a CSV File it fails. Below is the details of the command
    i am using to query to pull the data. Can anyone help me in getting the output of this query in SQL command prompt.
    sqlcmd -W -s , -S Servers FQDN
    use operationsmanager
    Go
    Query:"select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv"
    Go
    When i enter the command without the quotes when the query is starting and ending and also without the output command (-s "," -o "C:\DataSqlCmd.csv") it is working and shows the output in the command prompt. Below is the screen shot for
    your reference.
    Due to security reasons i have to erase the server names:
    But when i add the line to extract the output ( -s "," -o "C:\DataSqlCmd.csv") It gives me this error:
    The exact command would be:
    sqlcmd -W -s , -S CINMLVSCOM01.e2klab.ge.com
    use operationsmanager
    Go
    "select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "C:\DataSqlCmd.csv" -h-1
    Go
    saying the syntax is not correct or some thing as per the below screenshot.
    Can any one please help. Below is just the query whi i use to get the output in SQL management studio.
    Can any one make a command for the below quer so i can directly execute and test for getting the output.
    select Path, InstanceName, SampleValue 
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled
    Gautam.75801

    Can you try the below query?
    select Path, InstanceName, SampleValue
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < 20 and CounterName like '% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled
    -- replace the below query part in the below SQLCMD C:\>SQLCMD -S SERVERNAME -E -d operationsmanager -Q "select * from sys.databases ds with (nolock) where name='master'" -s "," -o "F:\PowerSQL\MyData.csv" -h -1
    SQLCMD -S SERVERNAME -E -d OperationsManager -Q "select Path, InstanceName, SampleValue
    from PerformanceDataAllView pdv with (NOLOCK)
    inner join PerformanceCounterView pcv on pdv.performancesourceinternalid = pcv.performancesourceinternalid
    inner join BaseManagedEntity bme on pcv.ManagedEntityId = bme.BaseManagedEntityId
    where SampleValue < '20' and CounterName='% Free Space' and TimeSampled > '2014-08-06 11:00:00.00'
    order by countername, timesampled" -s "," -o "c:\MyData.csv" -h -1
    Refer for the other ways 
    http://dba.stackexchange.com/questions/23566/writing-select-result-to-a-csv-file
    --Prashanth

  • How to convert Oracle User defined datatype to SQL Server 2014 using SSMA Version 6.0

    I am trying to convert Oracle 11g OE schema to SQL Server 2014, using SSMA version 6.0
    Getting an error in converting the Oracle View to SQL Server
    CREATE OR REPLACE VIEW OC_CUSTOMERS OF OE.CUSTOMER_TYP WITH OBJECT IDENTIFIER (customer_id) AS
    SELECT c.customer_id, c.cust_first_name, c.cust_last_name, c.cust_address,
               c.phone_numbers,c.nls_language,c.nls_territory,c.credit_limit,
               c.cust_email,
               CAST(MULTISET(SELECT o.order_id, o.order_mode,
                                   MAKE_REF(oc_customers,o.customer_id),
                                   o.order_status,
                                   o.order_total,o.sales_rep_id,
                                   CAST(MULTISET(SELECT l.order_id,l.line_item_id,
    l.unit_price,l.quantity,
    MAKE_REF(oc_product_information,
    l.product_id)
    FROM order_items l
    WHERE o.order_id = l.order_id)
                                        AS order_item_list_typ)
                             FROM orders o
                             WHERE c.customer_id = o.customer_id)
                    AS order_list_typ)
         FROM customers c
    *   SSMA error messages:
    *   O2SS0461: Conversion of object view is not supported.
    *   OF OE.CUSTOMER_TYP
    *      WITH OBJECT IDENTIFIER (customer_id)
    CREATE VIEW dbo.OC_CUSTOMERS
    AS
       /*Generated by SQL Server Migration Assistant for Oracle version 6.0.0.*/
       *   SSMA error messages:
       *   O2SS0481: Conversion of statement containing user defined type column 'c.cust_address' not supported.
       *   O2SS0481: Conversion of statement containing user defined type column 'c.phone_numbers' not supported.
       *   O2SS0430: Conversion of multiset conditions is not supported.
       *   CAST(MULTISET
       *      SELECT
       *         o.order_id,
       *         o.order_mode,
       *         MAKE_REF(oc_customers, o.customer_id),
       *         o.order_status,
       *         o.order_total,
       *         o.sales_rep_id,
       *         CAST(MULTISET
       *               SELECT
       *                  l.order_id,
       *                  l.line_item_id,
       *                  l.unit_price,
       *                  l.quantity,
       *                  MAKE_REF(oc_product_information, l.product_id)
       *               FROM order_items  l
       *               WHERE o.order_id = l.order_id
       *            ) AS order_item_list_typ)
       *      FROM orders  o
       *      WHERE c.customer_id = o.customer_id
       *   ) AS order_list_typ)
       SELECT
          c.CUSTOMER_ID,
          c.CUST_FIRST_NAME,
          c.CUST_LAST_NAME,
          c.cust_address,
          c.phone_numbers,
          c.NLS_LANGUAGE,
          c.NLS_TERRITORY,
          c.CREDIT_LIMIT,
          c.CUST_EMAIL,
          NULL
       FROM dbo.CUSTOMERS  AS c   */
    Any suggestion on converting this view would be helpful.
    Kind regards.

    Thanks Lydia Zhang for your reference urls.
    Please let me know if you come across any reference articles related to
    Creating a SQL Server table and View with columns as SQL Server TVP similar to Oracle UDT like
      CREATE TABLE "OE"."CUSTOMERS"
       (    "CUSTOMER_ID" NUMBER(6,0),
        "CUST_FIRST_NAME" VARCHAR2(20 BYTE) CONSTRAINT "CUST_FNAME_NN" NOT NULL ENABLE,
        "CUST_LAST_NAME" VARCHAR2(20 BYTE) CONSTRAINT "CUST_LNAME_NN" NOT NULL ENABLE,
        "CUST_ADDRESS" "OE"."CUST_ADDRESS_TYP" ,
        "PHONE_NUMBERS" "OE"."PHONE_LIST_TYP" ,
        "NLS_LANGUAGE" VARCHAR2(3 BYTE),
    And also creating a SQL Server TVP inside an another SQL Server TVP as in Oracle
    create or replace TYPE customer_typ
     AS OBJECT
        ( customer_id        NUMBER(6)
        , cust_first_name    VARCHAR2(20)
        , cust_last_name     VARCHAR2(20)
        , cust_address       cust_address_typ
       , credit_limit       NUMBER(9,2)
        , cust_email         VARCHAR2(30)
        , cust_orders        order_list_typ
    NOT FINAL;
    Kind regards.
    Venkatesha

  • How to convert this random pos AS2 code to AS3?

    Hi! I'm doing a sort of screensaver and need to random the logo all over the screen. In ActionScript 2 it was easy, just paste some code to the object and it works. The things to do this is total different in ActionScript 3 and I can't figure out how to solve this. It would be nice if someone could take a look at my very simple example and point me in the right direction. Maybe there is some example out there done in AS3?
    I can't figure out how to post fla so I renamed it to jpg. Just change the extension to fla again...
    Regards / Jimmy

    SORRY FOR THE LATE RESPONSE I WAS NOT ONLINE FOR THREE DAYS....
    I am still not able to download the file.
    What you can do is enclose the code which is called directly on the timeline in a function and call that function whenever required.
    You can also send the file on my mail ID at [email protected] [Make sure you zip it and the version is saved in CS3]

  • How to convert this BSO formulas into ASO formulas ?

    I need some help to convert this BSO formulas into ASO formulas:
    BSO formulas:
    12*("Head Count"->"Terminated"/((@PRIOR("Head Count"-> "Total Active & Leave")+"Head Count"->"Total Active & Leave")/2));
    "Head Count" is a member of the Account dimension
    "Terminated" and "Total Active & Leave" are members of the Status dimension
    Existing Active
    New Hire
    Active
    MAT
    STD
    OTH
    Leave
    Total Active & Leave
    Voluntary
    Involuntary
    Death
    Retirement
    End of Temp Assignment
    Terminated
    LTD
    Total Status
    Promotion Within Level
    Promotion to Higher Level
    Promotion
    No Total Status
    All Status
    Status (Dimension)
    In ASO, the formulas will be ??
    Thanks

    Try
    CASE WHEN IS([Period].CurrentMember, [Jan]) THEN
    12 * (([Head Count], [Terminated] ) /
    ((( [Head Count], [Total Active & Leave], [Dec], [Year].CurrentMember.lag(1) ) +
    ([Head Count], [Total Active & Leave])) / 2))
    ELSE
    12 * (([Head Count], [Terminated] ) /
    ((( [Head Count], [Total Active & Leave], [Time].CurrentMember.lag(1) ) +
    ([Head Count], [Total Active & Leave])) / 2))
    ENDTake note this assumes your Year dimension is in descending order
    Year
    --2007
    --2008
    --2009
    If Year is in Ascending order
    Year
    --2009
    --2008
    --2007
    Then you need to change
    [Year].CurrentMember.lag(1) to
    [Year].CurrentMember.lead(1)

  • NVARCHAR (MAX) TO PRINT DYNAMIC SQL QUERY TO A SQL FILE

    Hi 
    I have a requirement where i need to write an SP which would construct a huge query using dynamic SQL and save the Dynamic query to a file. 
    The Dynamic SQL Variable I am using as @NVARCHAR(MAX) but since the query being built is large (>4000 characters), I am not able to select it into a table. PRINT @SQL prints the whole query but SELECT @SQL prints only upto 4000 characterrs. 
    And I need to save this huge dynamix sql to a file using the SP.
    Any thoughts as to how i can achieve this?
    Rajiv

    This is a know problem with dynamic SQL nvarchar(max) concatenation.
    See below for correct assembly of large SQL strings:
    CREATE table #temp(qry nvarchar(max));
    declare @cmd nvarchar(max);
    SELECT @cmd=CONCAT(CONVERT(nvarchar(max),N'SELECT '),
    CONVERT(nvarchar(max),REPLICATE (N'A',4000)),
    CONVERT(nvarchar(max),REPLICATE (N'A',4000)),
    CONVERT(nvarchar(max),REPLICATE (N'A',4000)),
    CONVERT(nvarchar(max),REPLICATE (N'A',4000)),
    CONVERT(nvarchar(max),N'FROM SYS.TABLES'));
    insert into #temp SELECT @cmd;
    select * from #temp;
    select len(qry), datalength(qry) from #temp;
    -- 16022 32044
    drop table #temp;
    Dynamic SQL:  http://www.sqlusa.com/bestpractices/dynamicsql/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Need the SQL Query to check SQL time zone and change the time zone

    Hi All,
    I am using SQL Server 2008 SP2. My Ex SQL Admin said that the data which we query from our database gives the output in London time.
    But the SQL server is located in USA and is having US time.
    I would like to know how to find what time zone is the SQL application running on and how to change it ?
    Is there any query which i can use to determine and change the time zone ?
    Gautam.75801

    Refer the below two links
    http://blog.sqlauthority.com/2014/02/15/sql-server-get-current-timezone-name-in-sql-server/
    Check this link
    http://dba.stackexchange.com/questions/39421/how-to-handle-timezone-properly-in-sql-server
    SELECT [DateTimeUtil].[UDF_ConvertLocalToLocalByTimezoneIdentifier] (
    'GMT Standard Time', -- the original timezone in which your datetime is stored
    'Middle East Standard Time', -- the target timezone for your user
    '2014-03-30 01:55:00' -- the original datetime you want to convert
    --Prashanth

Maybe you are looking for