Subject | Re: RES: [firebird-support] How to copy Blob in SP |
---|---|
Author | zaher dirkey |
Post date | 2006-10-17T12:49:12Z |
--- In firebird-support@yahoogroups.com, "Eduardo Resek" <eresek@...>
wrote:
BLOB.
I will try it.
wrote:
>non-empty
>
> I stored files in Table blobs, in SP i want to copy records from table
> to another, or in same table with the contents of its blob.
> How, i can do it
>
> Thanks in advance.
>
> ---------------------
>
> Just as straight as it can be. Declare a blob variable, select some blob
> into it and insert it into another record. For instance, I have a table
> where I store report templates. Each new record is created with a
> version of the template.Thanks, but why i felt that way duplicating the BLOB id not Content of
>
> Table REPORT_TEMPLATE:
> Id bigint not null (primary key),
> RptName varchar(30) not null,
> Template blob subtype o segment size 80
>
> Procedure SP_NEWREPORT
> INPUT PARAMS : RPTNAME VARCHAR(30),
> ID_MODEL BIGINT /* ID TO COPY FROM (USED AS MODEL
> FOR NEW TEMPLATE */
>
> OUTPUT PARAM: ID BIGINT
>
> ...
> DECLARE VARIABLE TMPL BLOB SUB_TYPE 0 SEGMENT SIZE 80; /* ONLY USED IN
> OPTION 1 */
> BEGIN
> ID = GEN_ID( GEN_TEMPLATE, 1); -- GET GEN_TEMPLATE
> /* OPTION 1 */
> /* SELECT FROM MODEL */
> SELECT TEMPLATE FROM REPORT_TEMPLATE WHERE ID = :ID_MODEL INTO
> :TMPL;
> /* INSERT AS NEW */
> INSERT INTO REPORT_TEMPLATE (ID, RPTNAME, TEMPLATE) VALUES (:ID,
> :RPTNAME, :TMPL);
>
> /* OPTION 2 */
> INSERT INTO REPORT_TEMPLATE (ID, RPTNAME, TEMPLATE)
> SELECT :ID, :RPTNAME, TEMPLATE FROM REPORT_TEMPLATE WHERE ID =
> :ID_MODEL;
>
> END
>
>
> HIH,
>
> Eduardo Resek
>
BLOB.
I will try it.