Creating index in a stored procedure

Will execute immediate work?if so please can u give the syntax

Will execute immediate work?Why don't you try it for yourself and be surprised?
if so please can u give the syntaxhttp://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/executeimmediate_statement.htm

Similar Messages

  • Problem creating dataset using db2 stored procedure in Eclipse BIRT

    Hi,
    I am using DB2 9.7 Express Edition in Eclipse BIRT(version 2.5.1) for generating reports. I have used Type4 driver for jdbc connection.
    For that, I have established jdbc connection using db2jcc.jar and db2jcc_license_cu.jar files.
    I have successfully created data source, say DB2BIRT having following requisites-
    Driver Class - com.ibm.db2.jcc.DB2Driver ( v3.50)
    Driver URL - jdbc:db2://localhost:50000/database_name
    User name - user_name
    Password - Password
    I have written some stored procedures and trying to use resultsets from those stored procedures into my report..
    The stored procedures having involvement of only single resultset are working absolutely fine for new dataset using above DB2BIRT.
    But, I am unable to create new dataset using stored procedures those having involvement of multiple resultsets.
    I am getting following error as -
    org.eclipse.birt.data.engine.odaconsumer.PreparedStatement$SequentialResultSetHandler getMoreResults
    SEVERE: Cannot get more result sets from the statement.
    Cannot get the result set.
    SQL error #1: [jcc][10120][10943][3.50.152] Invalid operation: statement is closed. ERRORCODE=-4470, SQLSTATE=null
    org.eclipse.birt.report.data.oda.jdbc.JDBCException: Cannot get the result set.
    SQL error #1: [jcc][10120][10943][3.50.152] Invalid operation: statement is closed. ERRORCODE=-4470, SQLSTATE=null
    com.ibm.db2.jcc.b.SqlException: [jcc][10120][10943][3.50.152] Invalid operation: statement is closed. ERRORCODE=-4470, SQLSTATE=null
    at org.eclipse.birt.report.data.oda.jdbc.CallStatement.getMoreResults(CallStatement.java:1760)
    at org.eclipse.datatools.connectivity.oda.consumer.helper.OdaAdvancedQuery.getMoreResults(OdaAdvancedQuery.java:214)
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement$SequentialResultSetHandler.getMoreResults(PreparedStatement.java:5183)
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.getMoreResults(PreparedStatement.java:792)
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.flushResultSets(PreparedStatement.java:1009)
    at org.eclipse.birt.data.engine.odaconsumer.PreparedStatement.close(PreparedStatement.java:980)
    at org.eclipse.birt.data.engine.executor.DataSource$DataSourceReleaser.run(DataSource.java:374)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: com.ibm.db2.jcc.b.SqlException: [jcc][10120][10943][3.50.152] Invalid operation: statement is closed. ERRORCODE=-4470, SQLSTATE=null
    at com.ibm.db2.jcc.b.wc.a(wc.java:55)
    at com.ibm.db2.jcc.b.wc.a(wc.java:102)
    at com.ibm.db2.jcc.b.tk.db(tk.java:3118)
    at com.ibm.db2.jcc.b.tk.a(tk.java:1063)
    at com.ibm.db2.jcc.b.tk.getMoreResults(tk.java:908)
    at org.eclipse.birt.report.data.oda.jdbc.CallStatement.getMoreResults(CallStatement.java:1756)
    ... 7 more
    Moreover, I tried to resolve above issue by changing Driver Class from com.ibm.db2.jcc.DB2Driver ( v3.50) to com.ibm.db2.jcc.uw.DB2StoredProcDriver ( v3.50)
    So again while *"Test Connection"* for new Data source using this new driver class for stored procedure, there is an error reflection as -
    org.eclipse.birt.report.data.oda.jdbc.JDBCException: The selected driver cannot parse the given url.
    at org.eclipse.birt.report.data.oda.jdbc.JDBCDriverManager.testConnection(JDBCDriverManager.java:627)
    at org.eclipse.birt.report.data.oda.jdbc.ui.util.DriverLoader.testConnection(DriverLoader.java:120)
    at org.eclipse.birt.report.data.oda.jdbc.ui.util.DriverLoader.testConnection(DriverLoader.java:133)
    at org.eclipse.birt.report.data.oda.jdbc.ui.profile.JDBCSelectionPageHelper.testConnection(JDBCSelectionPageHelper.java:653)
    at org.eclipse.birt.report.data.oda.jdbc.ui.profile.JDBCSelectionPageHelper.access$7(JDBCSelectionPageHelper.java:627)
    at org.eclipse.birt.report.data.oda.jdbc.ui.profile.JDBCSelectionPageHelper$7.widgetSelected(JDBCSelectionPageHelper.java:549)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:228)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3493)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3112)
    at org.eclipse.jface.window.Window.runEventLoop(Window.java:825)
    at org.eclipse.jface.window.Window.open(Window.java:801)
    at org.eclipse.birt.report.designer.ui.dialogs.BaseDialog.open(BaseDialog.java:110)
    at org.eclipse.birt.report.designer.data.ui.actions.EditDataSourceAction.doAction(EditDataSourceAction.java:68)
    at org.eclipse.birt.report.designer.internal.ui.views.actions.AbstractElementAction.run(AbstractElementAction.java:70)
    at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
    at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1176)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3493)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3112)
    at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2405)
    at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
    at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:500)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:493)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
    Can anybody address my this issue for successful implementation of stored procedure(with involvement of multiple resultsets) for creating Data set in Eclipse BIRT ?
    I will be really thankful.
    Thanks in advance,
    Manasi

    Well, in my stored procedure I have used 2 to3 cursors(as per my business logic) and all cursors except one are holding result sets. That exceptional cursor is intended for holding as well as returning result set after call to the procedure. And its perfectly running on db2 and returning the desired output. The problem is with Eclipse. The same procedure is not working in Eclipse BIRT.

  • Creating a Oracle 10g stored procedure as a datasource for  crystal 9 repor

    Can someone direct me to instructions or information on how to create a Oracle 10g stored procedure as a datasource for  my Crystal  Reports 9.0  report?

    i've found this example for you
    http://www.pdssoftware.com/newsletter/mar07/page6.htm
    and you could be able to get the guides from the SAP guide website for the products
    http://help.sap.com/businessobject/product_guides/
    hope this was helpful
    good luck
    Amr

  • Creating universe from MySql stored procedure?

    Hi,
    I am new to BusinessObjects. I need to create universes based on the schema in our MySql database. However, when I tried to create one from a stored procedure, I fount that I wasn't allowed to do that or the option to insert a stored procedure was grayed out.
    Is it true that universe creation from MySql stored procedures not supported, or is it just something I didn't do right? Is there any workaround?
    Thanks in advance!

    jason Lee,
    You cannot combine universes with table structures with that of the stored procedures.Thats the reason in the existing universe the option is greyed out to insert stored procedures. You need to create a new universe thru design wizard and check the option to "create a universe through the stored procedure" in the first page.
    Let me know your results
    Thanks,
    Karthik

  • Creating Threads in Java Stored procedures

    Can I create threads inside Java Stored procedures?
    or is there a restriction?
    Thanks
    Kal

    Can I create threads inside Java Stored procedures?
    or is there a restriction?
    Thanks
    Kal Hi Kal,
    I don't mean to be rude, but have you tried it? Personally, I
    haven't tried it (since I didn't have the need).
    You don't say what version of Oracle DBMS you are using, but I
    am using 8.1.7.3 on Solaris 7, and according to Oracle's
    "Oracle 8i Java Developer's Guide", there is no restriction
    (of-course, that depends on what you call a "restriction" :-)
    http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.817/a83728/03writ11.htm#1003094
    Hope this helps.
    Good Luck,
    Avi.

  • Is is possible to create Socket using Java Stored Procedures/Function(Ora)?

    Hello Friends,
    Is is possible to create Socket using Java Stored Procedures/Function in Oracle?
    OR
    How I can send a message from oracle to Java Desktop Application which is working like server program?
    Please Guide !!

    J3Ganesh wrote:
    Hello Friends,
    Is is possible to create Socket using Java Stored Procedures/Function in Oracle?No, Oracle was very careful to take that feature out of the JDK provided in Oracle 10/11, but you can buy that feature back for, if I remember correctly, about 5000 dollars. (I actually raised a service request on this and then told my rep what I thought about the answer I received--some thing along the line of money grubbing so and so....)
    How I can send a message from oracle to Java Desktop Application which is working like server program?You can make a table and poll it from time to time from the Java side and write and commit what ever you want to the table. I do not know any way to send a signal from Oracle DB an external Java application--Java or PL/SQL stored procedure.

  • ORA-29855 - Error creating Spatial Index using a Stored Procedure

    Hi
    I am using Oracle 10gR2 database and I have written a stored procedure to create spatial index. But when i execute this function i get the following error message.
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13249: Error in R-tree: [mdrcrtscrt]
    ORA-13231: failed to create index table [MDRT_217C1$] during R-tree creation
    ORA-13249: Stmt-Execute Failure: CREATE TABLE FGDABZ40.MDRT_217C1$ (NODE_ID NUMBER, NODE_LEVEL NUMBER, INFO BLOB) LOB (INFO) STORE AS (CACHE) NOLOGGING PCTFREE 2
    ORA-29400: data cartridge error
    ORA-01031: insufficient privileges
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
    ORA-06512: at line 1
    ORA-06512: at "FGDABZ40.PKG_PSSDBE_APPLICATION", line 298
    ORA-06512: at line 17
    The tables that i am passing are registered in metadata and I am able to create indexes directly in sql plus. But when i try to create using this stored procedure, it fails.
    it should be possible to create indexes using a generic function. Has any faced a similar problem?
    regards
    sam

    Hi,
    I am having a same error on Oracle 10gR2 database. When I execute the same statement in sqlplus, it works. But it gives this error when I call the procedure which has this create spatial index statement.
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13249: Error in R-tree: [mdrcrtscrt]
    ORA-13231: failed to create index table [MDRT_20CDA$] during R-tree creation
    ORA-13249: Stmt-Execute Failure: CREATE TABLE "SDOMGR".MDRT_20CDA$ (NODE_ID NUMBER, NODE_LEVEL NUMBER, INFO BLOB) LOB (INFO) STORE AS (CACHE) NOLOGGING PCTFREE 2
    ORA-29400: data cartridge error
    ORA-01031: i
    Any help will be appreciated.
    Thanks,
    Sri

  • CREATE SEQUENCE from a stored procedure

    Hello,
    Is it possible, to create a sequence object from an own written stored procedure? Can I reinitialize the actual value of a sequence object without recreating it from a stored procedure?
    Thank you for recommendations,
    Matthias Schoelzel
    EDV Studio ALINA GmbH
    Bad Oeynhausen

    maybe this example might be of some help.
    SQL> create or replace procedure dy_sequence (pSeqName varchar2,
      2                                           pStart number,
      3                                           pIncrement number) as
      4    vCnt     number := 0;
      5  begin
      6    select count(*) into vCnt
      7      from all_sequences
      8     where sequence_name = upper(pSeqName);
      9 
    10    if vCnt = 0 then
    11      execute immediate 'create sequence '||pSeqName||
    12                        ' start with '||to_char(pStart)||
    13                        ' increment by '||to_char(pIncrement);
    14    else
    15      execute immediate 'alter sequence '||pSeqName||' increment by '||to_char(pIncrement);
    16    end if;
    17  end;
    18  /
    Procedure created.
    SQL> -- create the sequence by calling the dy_sequence procedure
    SQL> execute dy_sequence ('test_sequence',1,1);
    PL/SQL procedure successfully completed.
    SQL> select test_sequence.nextval from dual;
       NEXTVAL
             1
    SQL> -- alter the sequence to increment by 2
    SQL> execute dy_sequence ('test_sequence',0,2);
    PL/SQL procedure successfully completed.
    SQL> select test_sequence.nextval from dual;
       NEXTVAL
             3
    SQL>

  • Create table statement in stored procedures

    Hi,
    I am including the following statement in a stored procedure and receive the following error:
    STATEMENT:
    create table wrk_date (date date,
    qty smallint)
    tablespace temptabs;
    ERROR:
    PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
    begin declare exit for goto if loop mod null pragma raise
    return select update while <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> <<
    close current delete fetch lock insert open rollback
    savepoint set sql commit <a single-quoted SQL string>
    Is this statement not allowed or is there a possible syntax error above?
    I am using Oracle database version 8.0.5.
    Thanks.
    null

    Jimmy - You might want to buy the Following book from Oreilley Press Oracle Built in Pacakages it's very very good and came in handy when I has to write dynamic SQL (DBMS_SQL package).
    You might want to try www.bookpool.com which has technical books cheaper than amazon.
    Hope this helps.
    _Satish
    Oracle 8 Certified D.B.A.
    Sun Certified Sysadmin

  • Can't create valid PL/SQL stored procedure

    I have two questions about PL/SQL and JDBC:
    Question 1: I'm trying to create and execute a PL/SQL stored procedure, and I can't seem to get the syntax right. I'm trying to create the simplest stored proc I can. Here's the stored procedure:
    create or replace procedure test( inParam char(20) ) is
    begin
    select inParam from dual;
    end;
    When I try to execute it, I'm getting the error:
    PLS-00905: object TEST is invalid
    The creation of the proc, and the execution are being done using the same login.
    Question2: Once I get the stored procedure created, I want to call it from a JDBC application. Is this the correct syntax:
              CallableStatement stmt = connection.prepareCall("begin test('abc'); end;");
    or can I use the standard JDBC escape sequence:
              CallableStatement stmt = connection.prepareCall("{ call test('abc'); }");
    Thanks for your help,
    Jeff

    Forgot to mention, I'm using TimesTen 11.2.1.4.

  • Problem while creating table dynamically using stored procedure

    Hi all
    When i try to execute the following lines get insufficient privilege error.
    FYI: i m able to create table statically.(i.e without using stored procedure)
    CREATE OR REPLACE PROCEDURE pcalling IS
    str varchar2(60);
    BEGIN
    str:='create table t15(tno number,tname varchar2(5))';
    execute immediate str;
    END;
    Thanks in advance
    Satya

    hi
    SQL> CREATE OR REPLACE PROCEDURE runddl (ddl_in in VARCHAR2)
      2     AUTHID CURRENT_USER
      3  IS
      4  BEGIN
      5     EXECUTE IMMEDIATE ddl_in;
      6  END;
      7  .
    SQL> /
    Procedure created.AUTHID CURRENT_USER clause before the IS keyword which runddl executes, it should run under the authority of the invoker, or current user not the authority of the definer.
    if you omit it then it will no longer will be run if the creator doesnt have privelege to run this ddl regardless invoker has or not.
    i hope you got it
    Khurram Siddiqui
    [email protected]

  • Create composite/webservice using stored procedure

    Hi,
    I want to create a webservice which will execute the stored procedure and return me the resultset. I have to use this webservice in my ADF applicaiton to create Data control (DC) and furthter implementation.
    I have gone through few videos demonstrating how to create DC and use it in UI. However, I am not able to locate any documentation or video on creating composite/webservice.
    Can someone expalin how to do it or point me to any helpful documentation for this? I really appreciate any help on this as I am stuck here.
    Thanks
    Amit

    Hi Amit,
    As ADF Datacontrol abstracts the service implementation layer, you can create your service using any technology (Oracle SOA Suite may be your good choice).
    For creating a simple composite, see the Cue Cards in your Jdeveloper as Help > Cue Cards >  Work with SOA Technologies.
    Once you know how to create a composite, you can create the one that returns the result set as REF cursor after executing the SQL procedure. The following link should help you do that.
    http://docs.oracle.com/cd/E21764_01/integration.1111/e10231/adptr_db.htm#BGBFDDGC
    Now transform the resultset into the response variable of the service. This completes the composite development
    You can create a DC of this service now and consume it in your ADF process. You can also see some more demonstrations if you like.
    http://download.oracle.com/otn_hosted_doc/jdeveloper/11gdemos/CreatingCompositeUIs/CreatingCompositeUIsAudio.html
    For any issue this point onwards, put your question in ADF forum.
    Regards,
    Neeraj Sehgal

  • Create Dates table as stored procedure

    I want to modify this statement to use todays date as the start date and add 50 years to insert into table instead of entering a date range and execute it as a stored procedure. Can someone help me to modify this? Thanks
    /**Drop Tables*/
    DROP TABLE [dbo].[DimDate]
    GO
    /** Create Date Dimension Table **/
    /* Create First numbers table for key generation */
    CREATE TABLE Numbers_Small (Number INT);
    INSERT INTO Numbers_Small
    VALUES (0)
    ,(1)
    ,(2)
    ,(3)
    ,(4)
    ,(5)
    ,(6)
    ,(7)
    ,(8)
    ,(9);
    GO
    /* Create Second numbers table for key generation */
    CREATE TABLE Numbers_Big (Number_Big BIGINT);
    INSERT INTO Numbers_Big (Number_Big)
    SELECT (tenthousands.number * 10000 + thousands.number * 1000 + hundreds.number * 100 + tens.number * 10 + ones.number) AS number_big
    FROM numbers_small tenthousands
    ,numbers_small thousands
    ,numbers_small hundreds
    ,numbers_small tens
    ,numbers_small ones;
    GO
    /* Create Date Dimension Table */
    CREATE TABLE [dbo].[DimDate] (
    [DateKey] [int] NOT NULL
    ,[Date] [datetime] NOT NULL
    ,[Day] [char](10) NULL
    ,[DayOfWeek] [smallint] NULL
    ,[DayOfMonth] [smallint] NULL
    ,[DayOfYear] [smallint] NULL
    ,[PreviousDay] [datetime] NULL
    ,[NextDay] [datetime] NULL
    ,[WeekOfYear] [smallint] NULL
    ,[Month] [char](10) NULL
    ,[MonthOfYear] [smallint] NULL
    ,[QuarterOfYear] [smallint] NULL
    ,[Year] [int] NULL
    GO
    /* Create Date Key and Date Fields */
    INSERT INTO [DimDate] (
    DateKey
    ,DATE
    SELECT number_big
    ,DATEADD(day, number_big, '1900-01-01') AS DATE
    FROM numbers_big
    WHERE DATEADD(day, number_big, '1900-01-01') BETWEEN '1900-01-01'
    AND '2050-12-31'
    ORDER BY number_big;
    GO
    /* Update all other fields with appropriate data. */
    UPDATE [DimDate]
    SET Day = DATENAME(DW, DATE)
    ,DayOfWeek = DATEPART(WEEKDAY, DATE)
    ,DayOfMonth = DAY(DATE)
    ,DayOfYear = DATEPART(DY, DATE)
    ,PreviousDay = DATEADD(DAY, - 1, DATE)
    ,NextDay = DATEADD(DAY, 1, DATE)
    ,WeekOfYear = DATEPART(WK, DATE)
    ,Month = DATENAME(MONTH, DATE)
    ,MonthOfYear = MONTH(DATE)
    ,QuarterOfYear = DATEPART(Q, DATE)
    ,Year = YEAR(DATE);
    GO
    /* Drop Temp Tables */
    DROP TABLE Numbers_Small;
    DROP TABLE Numbers_Big;

    SQL is a database language, so why do you want to re-compute constant data over and over, hundreds of times a day for years? UGH! 
    There are 365.2422 days per year, so a century of calender data is only 36,525 rows! Maybe 40 bytes per row? About 1.5 Kbytes  total? This will fit into main storage
    What you did post was wrong. DATE is a reserved word in SQL and it is  unit of temporal measurement. You also seem to confuse columns and fields. In SQL a field is a sub-unit of a temporal measurement (YEARS, MONTH, DAY, HOUR, MINUTE, SECOND). Please
    learn the ISO-11179 rules for data element names.
    You crammed too much in the table. The new DATE data type is only 3 bytes! Your other columns are mostly redundant and have attribute splitting problems.  Try this:
    CREATE TABLE Calendar 
    (cal_date DATE NOT NULL PRIMARY KEY,
     julian_date INTEGER NOT NULL, 
     julian_business_day INTEGER NOT NULL, 
     ordinal_date CHAR(8) NOT NULL
       CHECK (ordinal_date 
           LIKE '[12][0-9][0-9][0-9]-[0-9][0-9][0-9]') NOT NULL,
     week_date CHAR(9) NOT NULL
        CHECK (week_date LIKE '[12][0-9][0-9][0-9]W[0-5][0-9]-[0-7])
    The julianized date is a sequential number over the whole calendar. It makes temporal math easier. 
    ISO-8601 week_date is the week-within-year. This format is 'yyyyWww-d' where yyyy is the year, W is a separator token, ww is (01-53) week number and d is (1-7) day of the week. 
    There are several websites with calendars you can cut & paste, but you can start your search with: http://www.calendar-365.com/week-number.html 
    The Julian business day is a good trick. Number the days from whenever your calendar starts and repeat a number for a weekend or company holiday. 
    CREATE TABLE Calendar
    (cal_date DATE NOT NULL PRIMARY KEY, 
     julian_business_nbr INTEGER NOT NULL, 
    INSERT INTO Calendar 
    VALUES ('2007-04-05', 42), 
     ('2007-04-06', 43), -- good Friday 
     ('2007-04-07', 43), 
     ('2007-04-08', 43), -- Easter Sunday 
     ('2007-04-09', 44), 
     ('2007-04-10', 45); --Tuesday
    To compute the business days from Thursday of this week to next
     Tuesdays:
    SELECT (C2.julian_business_nbr - C1.julian_business_nbr)
      FROM Calendar AS C1, Calendar AS C2
     WHERE C1.cal_date = '2007-04-05',
       AND C2.cal_date = '2007-04-10'; 
    Why store things like the month name in the table? This is a display field, not a schema column value. It is language dependent! It is only part of a scalar value, too; why not normalize? 
    But if you need them, then use computed columns that are not materialized until needed. Also, use the SUBSTRING() for things that are not numeric. Why use SMALLINT for the day of the week?  Are you going to divide Thursday by 42? It is a name, not a numeric. 
    You saw the tricks with a Series table wanted to use them, but do not  be the boy with a new hammer who thinks everything is a nail. I find that a spreadsheet is the best way to create such a calendar table because they have so many temporal options and
    functions. 
    Also, putting the comma at the start of  a line is an old punchcard trick that we do not use any more. Back in the 1960's, it let us re-arrange the deck and re-use the cards. All it cost us was readable code –- your eyes expect to see a comma after a string,
    so this makes a twitch as you read. 
    --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

  • How to create csv file in stored procedure

    I want the output of my stored procedure in a csv file. How can I do that?

    1) define File Paths
    2) Write the output comma seperated to the file.
    Simple :)
    Hope you are comfortable with File operations.
    URL for your reference
    PL/SQL output to .CSV file
    Regards,
    Bhushan

  • Creating a Dashboard with Stored Procedure

    Hello Experts
    I have a doubt. I'm starting to develop Dashboards for SAP b1.
    How do I pass a parameter for a procudure and can operate in DashBoard?
    I am using the example below, where the procudure brings the total billed a certain seller.
    Ex: Exec Dash03 (SELECT T0 [SlpName] FROM OSLP T0 WHERE T0 [SlpName] = '[% 0]')

    Hi SumanT
    I've never used the ITD (not sure how it works). Today I want to integrate the Dashboard to SAP Business One, and for this to work, it is necessary that within SAP B1 there is a query that results to feed the DashBoard.
    I tried using a variable to receive the name of the seller, and then pass the variable to the stored procedure, but still did not work out.

Maybe you are looking for

  • Applying a CSS style to an existing web page

    Hi all. I have recently updated the look of one of my web pages in my site. I'm looking to update the look of the other pages in my site as well to the same style/look. I have a CSS style saved as  "main layout" that I would like to use to apply the

  • Transfer photos form DSLR to iPhone 4s

    I have the ipad1, iPhone 4s and the ipad1 camera connection kit. I noticed that the iPad connection kit is not compatable with the iphone 4s. Is there any way to transfer photo and video from my DSLR or SD card to my iPhone 4s? Without first tranferr

  • Essbase administration service. The SQL data access source is greyed out

    Env: EAS 11g Oracle 10g database Hi, After i tried to install EAS and try to create a rule file, I find out that I am unable to select the datasource from "SQL data sources" field, which has been greyed out. However, I am able to make the connection

  • Page LInk

    I am extremely new to java. I mostly "edit" existing scripts to get what I need. I have downloaded a script that allows me to allow people to enter a file name to get an image file. The script takes people to the existing directory of the page which

  • Lightroom 4 - Processing Speed Restriction

    Hey together, im trying the trail version of lightroom 4 tonight. the big problem for me is that if i am in develop mode the the speed working speed of lightroom breaks down. its much more slower than lightroom 3 in development mode. If i choose the